feat: Styles views for macos

This commit is contained in:
2024-06-17 09:30:47 -04:00
parent 50e80d39eb
commit bd758fac90
7 changed files with 115 additions and 16 deletions

View File

@@ -6,6 +6,7 @@ extension View {
public func applyFormStyle() -> some View {
self
.labelsHidden()
// .formStyle(.grouped)
.textLabelStyle(.boldSecondary)
.textFieldStyle(.roundedBorder)
#if os(macOS)

View File

@@ -67,6 +67,15 @@ public struct AutomaticTextLabelStyle: TextLabelStyle {
}
}
public struct DefaultSectionHeaderLabelStyle: TextLabelStyle {
public func makeBody(configuration: Configuration) -> some View {
configuration.label
#if os(macOS)
.font(.headline)
#endif
}
}
private struct TextLabelStyleKey: EnvironmentKey {
static let defaultValue = MainActor.assumeIsolated {
AnyTextLabelStyle(style: AutomaticTextLabelStyle())
@@ -75,7 +84,7 @@ private struct TextLabelStyleKey: EnvironmentKey {
private struct SectionHeaderLabelStyleKey: EnvironmentKey {
static let defaultValue = MainActor.assumeIsolated {
AnyTextLabelStyle(style: AutomaticTextLabelStyle())
AnyTextLabelStyle(style: DefaultSectionHeaderLabelStyle())
}
}