yattee/Shared/Settings/SettingsHeader.swift

36 lines
851 B
Swift
Raw Permalink Normal View History

2021-11-04 22:01:27 +00:00
import SwiftUI
struct SettingsHeader: View {
var text: String
2022-01-06 15:02:53 +00:00
var secondary = false
2021-11-04 22:01:27 +00:00
var body: some View {
2022-01-06 15:02:53 +00:00
Group {
#if os(iOS)
if secondary {
EmptyView()
} else {
2023-05-25 16:26:34 +00:00
Text(text.localized())
2022-01-06 15:02:53 +00:00
}
#else
2023-05-25 16:26:34 +00:00
Text(text.localized())
2022-01-06 15:02:53 +00:00
#endif
}
#if os(tvOS)
.font(secondary ? .footnote : .title3)
.foregroundColor(.secondary)
.focusable(false)
#endif
#if os(macOS)
.font(secondary ? .system(size: 13) : .system(size: 15))
.foregroundColor(secondary ? Color.primary : .secondary)
2021-11-04 22:01:27 +00:00
#endif
}
}
struct SettingsHeader_Previews: PreviewProvider {
static var previews: some View {
SettingsHeader(text: "Header")
}
}