Display settings: keep example post on the top

This commit is contained in:
Thomas Ricouard 2023-03-26 19:19:59 +02:00
parent 92e15fdcc9
commit efb255eb62
2 changed files with 31 additions and 13 deletions

View file

@ -50,23 +50,40 @@ struct DisplaySettingsView: View {
routerPath: RouterPath()) // translate from latin button routerPath: RouterPath()) // translate from latin button
var body: some View { var body: some View {
Form { ZStack(alignment: .top) {
exampleSection Form {
themeSection StatusRowView(viewModel: { previewStatusViewModel })
fontSection .allowsHitTesting(false)
layoutSection .opacity(0)
platformsSection .hidden()
resetSection themeSection
fontSection
layoutSection
platformsSection
resetSection
}
.navigationTitle("settings.display.navigation-title")
.scrollContentBackground(.hidden)
.background(theme.secondaryBackgroundColor)
examplePost
} }
.navigationTitle("settings.display.navigation-title")
.scrollContentBackground(.hidden)
.background(theme.secondaryBackgroundColor)
} }
private var exampleSection: some View { private var examplePost: some View {
Section("settings.display.example-toot") { VStack(spacing: 0) {
StatusRowView(viewModel: { previewStatusViewModel }) StatusRowView(viewModel: { previewStatusViewModel })
.allowsHitTesting(false) .allowsHitTesting(false)
.padding(.layoutPadding)
.background(theme.primaryBackgroundColor)
.cornerRadius(8)
.padding(.horizontal, .layoutPadding)
.padding(.top, .layoutPadding)
.background(theme.secondaryBackgroundColor)
Rectangle()
.fill(theme.secondaryBackgroundColor)
.frame(height: 30)
.mask(LinearGradient(gradient: Gradient(colors: [theme.secondaryBackgroundColor, .clear]),
startPoint: .top, endPoint: .bottom))
} }
} }

View file

@ -135,7 +135,8 @@ public final class Status: AnyStatus, Codable, Identifiable, Equatable, Hashable
public static func placeholder(forSettings: Bool = false, language: String? = nil) -> Status { public static func placeholder(forSettings: Bool = false, language: String? = nil) -> Status {
.init(id: UUID().uuidString, .init(id: UUID().uuidString,
content: .init(stringValue: "Lorem ipsum [#dolor](#) sit amet\nconsectetur [@adipiscing](#) elit\nAsed do eiusmod tempor incididunt ut labore.", parseMarkdown: forSettings), content: .init(stringValue: "Lorem ipsum [#dolor](#) sit amet\nconsectetur [@adipiscing](#) elit.",
parseMarkdown: forSettings),
account: .placeholder(), account: .placeholder(),
createdAt: ServerDate(), createdAt: ServerDate(),