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())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,8 +28,7 @@ struct CreateRoomScreen: View {
|
||||
var body: some View {
|
||||
mainContent
|
||||
.scrollDismissesKeyboard(.immediately)
|
||||
.scrollContentBackground(.hidden)
|
||||
.background(Color.element.formBackground.ignoresSafeArea())
|
||||
.elementFormStyle()
|
||||
.navigationTitle(L10n.screenCreateRoomTitle)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
|
||||
@@ -85,8 +85,7 @@ struct DeveloperOptionsScreen: View {
|
||||
}
|
||||
}
|
||||
.overlay(effectsView)
|
||||
.scrollContentBackground(.hidden)
|
||||
.background(Color.element.formBackground.ignoresSafeArea())
|
||||
.elementFormStyle()
|
||||
.navigationTitle(L10n.commonDeveloperOptions)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
|
||||
@@ -22,8 +22,7 @@ struct InviteUsersScreen: View {
|
||||
|
||||
var body: some View {
|
||||
mainContent
|
||||
.scrollContentBackground(.hidden)
|
||||
.background(Color.element.formBackground.ignoresSafeArea())
|
||||
.elementFormStyle()
|
||||
.navigationTitle(L10n.screenCreateRoomActionInvitePeople)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
|
||||
@@ -27,8 +27,7 @@ struct RoomDetailsEditScreen: View {
|
||||
|
||||
var body: some View {
|
||||
mainContent
|
||||
.scrollContentBackground(.hidden)
|
||||
.background(Color.element.formBackground.ignoresSafeArea())
|
||||
.elementFormStyle()
|
||||
.scrollDismissesKeyboard(.immediately)
|
||||
.navigationTitle(L10n.screenRoomDetailsEditRoomTitle)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
|
||||
@@ -41,8 +41,7 @@ struct RoomDetailsScreen: View {
|
||||
leaveRoomSection
|
||||
}
|
||||
}
|
||||
.scrollContentBackground(.hidden)
|
||||
.background(Color.element.formBackground.ignoresSafeArea())
|
||||
.elementFormStyle()
|
||||
.alert(item: $context.alertInfo) { $0.alert }
|
||||
.alert(item: $context.leaveRoomAlertItem,
|
||||
actions: leaveRoomAlertActions,
|
||||
|
||||
@@ -27,8 +27,7 @@ struct RoomMemberDetailsScreen: View {
|
||||
blockUserSection
|
||||
}
|
||||
}
|
||||
.scrollContentBackground(.hidden)
|
||||
.background(Color.element.formBackground.ignoresSafeArea())
|
||||
.elementFormStyle()
|
||||
.alert(item: $context.ignoreUserAlert, actions: blockUserAlertActions, message: blockUserAlertMessage)
|
||||
.errorAlert(item: $context.errorAlert)
|
||||
}
|
||||
|
||||
@@ -28,8 +28,7 @@ struct StartChatScreen: View {
|
||||
searchContent
|
||||
}
|
||||
}
|
||||
.scrollContentBackground(.hidden)
|
||||
.background(Color.element.formBackground.ignoresSafeArea())
|
||||
.elementFormStyle()
|
||||
.navigationTitle(L10n.actionStartChat)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
|
||||
Reference in New Issue
Block a user