import SwiftUI

struct StringPropertyView: View {

    let title: LocalizedStringKey

    @Binding
    var text: String

    let prompt: String?

    let footer: LocalizedStringKey

    init(title: LocalizedStringKey, text: Binding<String>, prompt: String? = nil, footer: LocalizedStringKey) {
        self.title = title
        self._text = text
        self.prompt = prompt
        self.footer = footer
    }

    var body: some View {
        GenericPropertyView(title: title, footer: footer) {
            TextField(title, text: $text, prompt: prompt.map(Text.init))
                .textFieldStyle(.roundedBorder)
        }
    }
}
