Skip to content

Commit 059f754

Browse files
committed
update top tab style
1 parent cc9c415 commit 059f754

File tree

2 files changed

+37
-27
lines changed

2 files changed

+37
-27
lines changed

iosApp/flare/UI/Screen/DiscoverScreen.swift

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,17 @@ struct DiscoverScreen: View {
4949
.listRowInsets(.init(top: 0, leading: 0, bottom: 0, trailing: 0))
5050
.listRowBackground(Color.clear)
5151
}
52-
Section {
53-
TimelinePagingView(data: searchPresenter.state.status)
54-
} header: {
55-
Text("search_status")
52+
if !searchPresenter.state.status.isEmpty && !searchPresenter.state.status.isError {
53+
Section {
54+
TimelinePagingView(data: searchPresenter.state.status)
55+
} header: {
56+
Text("search_status")
57+
}
58+
.listRowSeparator(.hidden)
59+
.padding(.horizontal)
60+
.listRowInsets(.init(top: 0, leading: 0, bottom: 0, trailing: 0))
61+
.listRowBackground(Color.clear)
5662
}
57-
.listRowSeparator(.hidden)
58-
.padding(.horizontal)
59-
.listRowInsets(.init(top: 0, leading: 0, bottom: 0, trailing: 0))
60-
.listRowBackground(Color.clear)
6163

6264
} else {
6365
if case .success(let usersState) = onEnum(of: presenter.state.users) {
@@ -129,7 +131,7 @@ struct DiscoverScreen: View {
129131
.listRowInsets(.init(top: 0, leading: 0, bottom: 0, trailing: 0))
130132
.listRowBackground(Color.clear)
131133
}
132-
if !presenter.state.status.isEmpty {
134+
if !presenter.state.status.isEmpty && !presenter.state.status.isEmpty {
133135
Section {
134136
TimelinePagingView(data: presenter.state.status)
135137
} header: {

iosApp/flare/UI/Screen/HomeTimelineScreen.swift

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ struct HomeTimelineScreen: View {
2121

2222
var body: some View {
2323
GeometryReader { proxy in
24-
let headerHeight = 72 + proxy.safeAreaInsets.top
24+
let headerHeight = 60 + proxy.safeAreaInsets.top
2525
StateView(state: presenter.state.tabState) { state in
2626
let tabs: [TimelineTabItem] = state.cast(TimelineTabItem.self)
2727
let tab = tabs[selectedTabIndex]
@@ -40,7 +40,7 @@ struct HomeTimelineScreen: View {
4040
})
4141
.onScrollPhaseChange({ oldPhase, newPhase, context in
4242
if !newPhase.isScrolling && (headerOffset != 0 || headerOffset != headerHeight) {
43-
withAnimation(.snappy(duration: 0.25, extraBounce: 0)) {
43+
withAnimation(.spring) {
4444
if headerOffset > (headerHeight * 0.5) {
4545
headerOffset = headerHeight
4646
} else {
@@ -60,23 +60,30 @@ struct HomeTimelineScreen: View {
6060
) {
6161
ScrollView(.horizontal) {
6262
GlassEffectContainer {
63-
HStack {
63+
HStack(
64+
spacing: 8,
65+
) {
6466
ForEach(0..<tabs.count, id: \.self) { index in
6567
let tab = tabs[index]
66-
Button {
67-
selectedTabIndex = index
68-
} label: {
69-
Label {
70-
TabTitle(title: tab.metaData.title)
71-
} icon: {
72-
TabIcon(icon: tab.metaData.icon, accountType: tab.account, size: 24)
73-
.font(.title)
74-
}
68+
69+
Label {
70+
TabTitle(title: tab.metaData.title)
71+
.font(.subheadline)
72+
} icon: {
73+
TabIcon(icon: tab.metaData.icon, accountType: tab.account, size: 24)
74+
.font(.title)
7575
}
76-
.if(selectedTabIndex == index) { button in
77-
button.buttonStyle(.borderedProminent)
78-
} else: { button in
79-
button.buttonStyle(.bordered)
76+
.padding(.horizontal)
77+
.padding(.vertical, 8)
78+
.foregroundStyle(selectedTabIndex == index ? Color.white : .primary)
79+
.background(
80+
Capsule()
81+
.foregroundColor(selectedTabIndex == index ? .accentColor : Color(.systemBackground))
82+
)
83+
.onTapGesture {
84+
withAnimation(.spring) {
85+
selectedTabIndex = index
86+
}
8087
}
8188
}
8289
if case .success = onEnum(of: presenter.state.user) {
@@ -108,8 +115,9 @@ struct HomeTimelineScreen: View {
108115
.buttonStyle(.glass)
109116
}
110117
}
111-
.padding()
112-
.background(Color(.systemGroupedBackground))
118+
.padding(.horizontal)
119+
.padding(.vertical, 8)
120+
.background(.regularMaterial)
113121
.offset(y: -headerOffset)
114122
}
115123
.toolbarVisibility(.hidden, for: .navigationBar)

0 commit comments

Comments
 (0)