Fix profile pinned post UI

This commit is contained in:
Thomas Ricouard 2023-02-12 18:14:34 +01:00
parent eb6050a38f
commit aab397f2bb

View file

@ -67,9 +67,6 @@ public struct AccountDetailView: View {
case .statuses: case .statuses:
if viewModel.selectedTab == .statuses { if viewModel.selectedTab == .statuses {
pinnedPostsView pinnedPostsView
.listRowInsets(.init())
.listRowSeparator(.hidden)
.listRowBackground(theme.primaryBackgroundColor)
} }
StatusesListView(fetcher: viewModel) StatusesListView(fetcher: viewModel)
case .followedTags: case .followedTags:
@ -78,6 +75,7 @@ public struct AccountDetailView: View {
listsListView listsListView
} }
} }
.environment(\.defaultMinListRowHeight, 1)
.listStyle(.plain) .listStyle(.plain)
.scrollContentBackground(.hidden) .scrollContentBackground(.hidden)
.background(theme.primaryBackgroundColor) .background(theme.primaryBackgroundColor)
@ -327,19 +325,24 @@ public struct AccountDetailView: View {
@ViewBuilder @ViewBuilder
private var pinnedPostsView: some View { private var pinnedPostsView: some View {
if !viewModel.pinned.isEmpty { if !viewModel.pinned.isEmpty {
Label("account.post.pinned", systemImage: "pin.fill")
.font(.scaledFootnote)
.foregroundColor(.gray)
.fontWeight(.semibold)
.listRowInsets(.init(top: 0,
leading: 12,
bottom: 0,
trailing: .layoutPadding))
.listRowSeparator(.hidden)
.listRowBackground(theme.primaryBackgroundColor)
ForEach(viewModel.pinned) { status in ForEach(viewModel.pinned) { status in
VStack(alignment: .leading) { StatusRowView(viewModel: .init(status: status))
Label("account.post.pinned", systemImage: "pin.fill")
.font(.scaledFootnote)
.foregroundColor(.gray)
.fontWeight(.semibold)
StatusRowView(viewModel: .init(status: status))
}
.padding(.horizontal, .layoutPadding)
Rectangle()
.frame(height: 12)
.foregroundColor(theme.secondaryBackgroundColor)
} }
Rectangle()
.fill(theme.secondaryBackgroundColor)
.frame(height: 12)
.listRowInsets(.init())
.listRowSeparator(.hidden)
} }
} }