Improve page and post detail views
This commit is contained in:
40
CHDataManagement/Views/Generic/DescriptionField.swift
Normal file
40
CHDataManagement/Views/Generic/DescriptionField.swift
Normal file
@ -0,0 +1,40 @@
|
||||
import SwiftUI
|
||||
|
||||
struct DescriptionField: View {
|
||||
|
||||
@Binding
|
||||
var text: String
|
||||
|
||||
var body: some View {
|
||||
TextEditor(text: $text)
|
||||
.font(.body)
|
||||
.lineLimit(5, reservesSpace: true)
|
||||
.frame(maxWidth: 400, minHeight: 50, maxHeight: 500)
|
||||
.textEditorStyle(.plain)
|
||||
.padding(.vertical, 8)
|
||||
.padding(.leading, 3)
|
||||
.background(Color.gray.opacity(0.1))
|
||||
.cornerRadius(8)
|
||||
}
|
||||
}
|
||||
|
||||
struct OptionalDescriptionField: View {
|
||||
|
||||
@Binding
|
||||
var text: String?
|
||||
|
||||
var body: some View {
|
||||
TextEditor(text: Binding(
|
||||
get: { text ?? "" },
|
||||
set: { text = $0.isEmpty ? nil : $0 }
|
||||
))
|
||||
.font(.body)
|
||||
.lineLimit(5, reservesSpace: true)
|
||||
.frame(maxWidth: 400, minHeight: 50, maxHeight: 500)
|
||||
.textEditorStyle(.plain)
|
||||
.padding(.vertical, 8)
|
||||
.padding(.leading, 3)
|
||||
.background(Color.gray.opacity(0.1))
|
||||
.cornerRadius(8)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user