mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Backport base Form style from Compound. (#1009)
Apply to all screens using the formBackground colour.
This commit is contained in:
@@ -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())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user