Backport base Form style from Compound. (#1009)

Apply to all screens using the formBackground colour.
This commit is contained in:
Doug
2023-06-02 11:39:03 +01:00
committed by GitHub
parent 0972af30cf
commit 44062adb0f
8 changed files with 21 additions and 37 deletions
@@ -16,32 +16,23 @@
import SwiftUI
/// Style for form section headers
struct FormSectionHeaderStyle: ViewModifier {
func body(content: Content) -> some View {
content
.foregroundColor(.element.secondaryContent)
extension View {
/// Applies a standard style to forms.
func elementFormStyle() -> some View {
scrollContentBackground(.hidden)
.background(Color.element.formBackground.ignoresSafeArea())
}
/// Applies a standard style for form header text.
func formSectionHeader() -> some View {
foregroundColor(.element.secondaryContent)
.font(.compound.bodyXS)
}
}
/// Standard style for form sections
struct FormSectionStyle: ViewModifier {
func body(content: Content) -> some View {
content
.listRowSeparator(.hidden)
/// Applies a standard style for form sections.
func formSectionStyle() -> some View {
listRowSeparator(.hidden)
.listRowInsets(FormRow.insets)
.listRowBackground(Color.element.formRowBackground)
}
}
extension View {
/// Applies the `FormSectionHeaderStyle` modifier to the view
func formSectionHeader() -> some View {
modifier(FormSectionHeaderStyle())
}
func formSectionStyle() -> some View {
modifier(FormSectionStyle())
}
}