Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added shadows to tab bar when tabs overflow #1412

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Made the shadows only show if using Xcode-style tabs. Fixed SwiftLint…
… errors.
austincondiff committed Aug 22, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit b2d86935bb8239973275a911489634a8fb8f8b54
34 changes: 19 additions & 15 deletions CodeEdit/Features/Tabs/Views/TabBarView.swift
Original file line number Diff line number Diff line change
@@ -294,13 +294,15 @@ struct TabBarView: View {
leadingAccessories
.background(.clear)
.overlay(alignment: .trailing) {
TabBarShadow(
width: colorScheme == .dark ? 5 : 7,
startPoint: .leading,
endPoint: .trailing
)
.offset(x: colorScheme == .dark ? 5 : 7)
.opacity(scrollOffset >= 0 ? 0 : 1)
if tabBarStyle == .xcode {
TabBarShadow(
width: colorScheme == .dark ? 5 : 7,
startPoint: .leading,
endPoint: .trailing
)
.offset(x: colorScheme == .dark ? 5 : 7)
.opacity(scrollOffset >= 0 ? 0 : 1)
}
}
.zIndex(1)
// Tab bar items.
@@ -401,7 +403,7 @@ struct TabBarView: View {
}
.frame(height: TabBarView.height)
}

// To fill up the parent space of tab bar.
.frame(maxWidth: .infinity)
.background {
@@ -419,13 +421,15 @@ struct TabBarView: View {
// Tab bar tools (e.g. split view).
trailingAccessories
.overlay(alignment: .leading) {
TabBarShadow(
width: colorScheme == .dark ? 5 : 7,
startPoint: .trailing,
endPoint: .leading
)
.offset(x: colorScheme == .dark ? -5 : -7)
.opacity((scrollTrailingOffset ?? 0) <= 0 ? 0 : 1)
if tabBarStyle == .xcode {
TabBarShadow(
width: colorScheme == .dark ? 5 : 7,
startPoint: .trailing,
endPoint: .leading
)
.offset(x: colorScheme == .dark ? -5 : -7)
.opacity((scrollTrailingOffset ?? 0) <= 0 ? 0 : 1)
}
}
.zIndex(1)
}