From aab397f2bb1a571f909c3625cf9dce8c08423094 Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Sun, 12 Feb 2023 18:14:34 +0100 Subject: [PATCH] Fix profile pinned post UI --- .../Sources/Account/AccountDetailView.swift | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/Packages/Account/Sources/Account/AccountDetailView.swift b/Packages/Account/Sources/Account/AccountDetailView.swift index aa515abc..e4f96dbc 100644 --- a/Packages/Account/Sources/Account/AccountDetailView.swift +++ b/Packages/Account/Sources/Account/AccountDetailView.swift @@ -67,9 +67,6 @@ public struct AccountDetailView: View { case .statuses: if viewModel.selectedTab == .statuses { pinnedPostsView - .listRowInsets(.init()) - .listRowSeparator(.hidden) - .listRowBackground(theme.primaryBackgroundColor) } StatusesListView(fetcher: viewModel) case .followedTags: @@ -78,6 +75,7 @@ public struct AccountDetailView: View { listsListView } } + .environment(\.defaultMinListRowHeight, 1) .listStyle(.plain) .scrollContentBackground(.hidden) .background(theme.primaryBackgroundColor) @@ -327,19 +325,24 @@ public struct AccountDetailView: View { @ViewBuilder private var pinnedPostsView: some View { 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 - VStack(alignment: .leading) { - 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) + StatusRowView(viewModel: .init(status: status)) } + Rectangle() + .fill(theme.secondaryBackgroundColor) + .frame(height: 12) + .listRowInsets(.init()) + .listRowSeparator(.hidden) } }