Improve page and post detail views

This commit is contained in:
Christoph Hagen
2024-12-07 00:09:35 +01:00
parent 42a5d01480
commit 394cf7a2e4
13 changed files with 355 additions and 109 deletions

View File

@ -8,9 +8,12 @@ struct OptionalTextField: View {
// The optional text that will be passed in and out of the component
@Binding var text: String?
init(_ titleKey: LocalizedStringKey, text: Binding<String?>) {
let prompt: String?
init(_ titleKey: LocalizedStringKey, text: Binding<String?>, prompt: String? = nil) {
self.titleKey = titleKey
self._text = text
self.prompt = prompt
}
var body: some View {
@ -23,6 +26,6 @@ struct OptionalTextField: View {
// Convert an empty string to `nil`
text = newValue.isEmpty ? nil : newValue
}
))
), prompt: prompt.map(Text.init))
}
}