From 435f28dda9968de7f2cdf18469ebc2a182fb190b Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Fri, 6 Sep 2024 11:32:49 +0200 Subject: [PATCH] UI tweaks --- IceCubesApp/App/SideBarView.swift | 32 +++++++++++-------- .../View/TimelineQuickAccessPills.swift | 1 + 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/IceCubesApp/App/SideBarView.swift b/IceCubesApp/App/SideBarView.swift index 290ded33..6ad747c6 100644 --- a/IceCubesApp/App/SideBarView.swift +++ b/IceCubesApp/App/SideBarView.swift @@ -34,26 +34,32 @@ struct SideBarView: View { return 0 } - private func makeIconForTab(tab: Tab) -> some View { + private func makeIconForTab(tab: AppTab) -> some View { HStack { ZStack(alignment: .topTrailing) { SideBarIcon(systemIconName: tab.iconName, isSelected: tab == selectedTab) - let badge = badgeFor(tab: tab) - if badge > 0 { - makeBadgeView(count: badge) + if userPreferences.isSidebarExpanded { + Text(tab.title) + .font(.headline) + .foregroundColor(tab == selectedTab ? theme.tintColor : theme.labelColor) + .frame(maxWidth: .infinity, alignment: .leading) } } - if userPreferences.isSidebarExpanded { - Text(tab.title) - .font(.headline) - .foregroundColor(tab == selectedTab ? theme.tintColor : theme.labelColor) - .frame(maxWidth: .infinity, alignment: .leading) + .frame(width: (userPreferences.isSidebarExpanded ? .sidebarWidthExpanded : .sidebarWidth) - 24, height: 50) + .background(tab == selectedTab ? theme.primaryBackgroundColor : .clear, + in: RoundedRectangle(cornerRadius: 8)) + .cornerRadius(8) + .shadow(color: tab == selectedTab ? .black.opacity(0.2) : .clear, radius: 5) + .overlay( + RoundedRectangle(cornerRadius: 8) + .stroke(tab == selectedTab ? theme.labelColor.opacity(0.1) : .clear, lineWidth: 1) + ) + let badge = badgeFor(tab: tab) + if badge > 0 { + makeBadgeView(count: 10) } } - .frame(width: (userPreferences.isSidebarExpanded ? .sidebarWidthExpanded : .sidebarWidth) - 24, height: 50) - .background(tab == selectedTab ? theme.secondaryBackgroundColor : .clear, - in: RoundedRectangle(cornerRadius: 8)) } private func makeBadgeView(count: Int) -> some View { @@ -65,7 +71,7 @@ struct SideBarView: View { .font(.caption2) } .frame(width: 24, height: 24) - .offset(x: 14, y: -14) + .offset(x: 10, y: -10) } private var postButton: some View { diff --git a/Packages/Timeline/Sources/Timeline/View/TimelineQuickAccessPills.swift b/Packages/Timeline/Sources/Timeline/View/TimelineQuickAccessPills.swift index a27aef46..560ade52 100644 --- a/Packages/Timeline/Sources/Timeline/View/TimelineQuickAccessPills.swift +++ b/Packages/Timeline/Sources/Timeline/View/TimelineQuickAccessPills.swift @@ -25,6 +25,7 @@ struct TimelineQuickAccessPills: View { } .scrollClipDisabled() .scrollIndicators(.never) + .scrollBounceBehavior(.basedOnSize, axes: [.horizontal, .vertical]) .onChange(of: currentAccount.lists) { _, lists in guard client.isAuth else { return } var filters = pinnedFilters