mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
macos: further simplify using a @ViewBuilder
This commit is contained in:
@ -116,6 +116,15 @@ struct AboutView: View {
|
||||
self.url = url
|
||||
}
|
||||
|
||||
@ViewBuilder private var textView: some View {
|
||||
Text(text)
|
||||
.frame(width: 125, alignment: .leading)
|
||||
.padding(.leading, 2)
|
||||
.tint(.secondary)
|
||||
.opacity(0.8)
|
||||
.monospaced()
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: 4) {
|
||||
Text(label)
|
||||
@ -123,10 +132,10 @@ struct AboutView: View {
|
||||
.padding(.trailing, 2)
|
||||
if let url {
|
||||
Link(destination: url) {
|
||||
PropertyText(text: text)
|
||||
textView
|
||||
}
|
||||
} else {
|
||||
PropertyText(text: text)
|
||||
textView
|
||||
}
|
||||
}
|
||||
.font(.callout)
|
||||
@ -134,19 +143,6 @@ struct AboutView: View {
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
}
|
||||
|
||||
private struct PropertyText: View {
|
||||
let text: String
|
||||
|
||||
var body: some View {
|
||||
Text(text)
|
||||
.frame(width: 125, alignment: .leading)
|
||||
.padding(.leading, 2)
|
||||
.tint(.secondary)
|
||||
.opacity(0.8)
|
||||
.monospaced()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct AboutView_Previews: PreviewProvider {
|
||||
|
Reference in New Issue
Block a user