mirror of
https://github.com/lumaa-dev/BubbleApp.git
synced 2025-01-01 11:37:40 +01:00
Additional tab actions
This commit is contained in:
parent
c8853d9e05
commit
fda864a418
@ -4,12 +4,20 @@ import SwiftUI
|
||||
|
||||
struct TabsView: View {
|
||||
@Binding var selectedTab: TabDestination
|
||||
var postButton: () -> Void
|
||||
|
||||
var postButton: () -> Void = {}
|
||||
var tapAction: () -> Void = {}
|
||||
var retapAction: () -> Void = {}
|
||||
|
||||
var body: some View {
|
||||
HStack(alignment: .center) {
|
||||
Button {
|
||||
selectedTab = .timeline
|
||||
if selectedTab == .timeline {
|
||||
retapAction()
|
||||
} else {
|
||||
selectedTab = .timeline
|
||||
tapAction()
|
||||
}
|
||||
} label: {
|
||||
if selectedTab == .timeline {
|
||||
Tabs.timeline.imageFill
|
||||
@ -22,7 +30,12 @@ struct TabsView: View {
|
||||
Spacer()
|
||||
|
||||
Button {
|
||||
selectedTab = .search
|
||||
if selectedTab == .search {
|
||||
retapAction()
|
||||
} else {
|
||||
selectedTab = .search
|
||||
tapAction()
|
||||
}
|
||||
} label: {
|
||||
if selectedTab == .search {
|
||||
Tabs.search.imageFill
|
||||
@ -44,7 +57,12 @@ struct TabsView: View {
|
||||
Spacer()
|
||||
|
||||
Button {
|
||||
selectedTab = .activity
|
||||
if selectedTab == .activity {
|
||||
retapAction()
|
||||
} else {
|
||||
selectedTab = .activity
|
||||
tapAction()
|
||||
}
|
||||
} label: {
|
||||
if selectedTab == .activity {
|
||||
Tabs.activity.imageFill
|
||||
@ -57,7 +75,12 @@ struct TabsView: View {
|
||||
Spacer()
|
||||
|
||||
Button {
|
||||
selectedTab = .profile
|
||||
if selectedTab == .profile {
|
||||
retapAction()
|
||||
} else {
|
||||
selectedTab = .profile
|
||||
tapAction()
|
||||
}
|
||||
} label: {
|
||||
if selectedTab == .profile {
|
||||
Tabs.profile.imageFill
|
||||
|
@ -38,13 +38,11 @@ struct ContentView: View {
|
||||
})
|
||||
}
|
||||
.overlay(alignment: .bottom) {
|
||||
if uniNavigator.showTabbar {
|
||||
TabsView(selectedTab: $uniNavigator.selectedTab) {
|
||||
uniNavigator.presentedSheet = .post(content: "", replyId: nil, editId: nil)
|
||||
}
|
||||
.offset(y: uniNavigator.showTabbar ? 0 : -20)
|
||||
.zIndex(10)
|
||||
TabsView(selectedTab: $uniNavigator.selectedTab) {
|
||||
uniNavigator.presentedSheet = .post(content: "", replyId: nil, editId: nil)
|
||||
}
|
||||
.padding(.vertical, 10)
|
||||
.zIndex(10)
|
||||
}
|
||||
.withSheets(sheetDestination: $uniNavigator.presentedSheet)
|
||||
.withCovers(sheetDestination: $uniNavigator.presentedCover)
|
||||
|
Loading…
Reference in New Issue
Block a user