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
var body: some View {
Form {
exampleSection
themeSection
fontSection
layoutSection
platformsSection
resetSection
ZStack(alignment: .top) {
Form {
StatusRowView(viewModel: { previewStatusViewModel })
.allowsHitTesting(false)
.opacity(0)
.hidden()
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 {
Section("settings.display.example-toot") {
private var examplePost: some View {
VStack(spacing: 0) {
StatusRowView(viewModel: { previewStatusViewModel })
.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 {
.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(),
createdAt: ServerDate(),