-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed animation from the custom TabBar, which caused unpredictable …
…behavior of the screens
- Loading branch information
Konstantin Kochetkov
committed
Nov 9, 2023
1 parent
84c4164
commit 0c5407d
Showing
5 changed files
with
65 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// | ||
// UI Components.swift | ||
// Expense Tracker | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct ClearButton: ViewModifier { | ||
@Binding var text: String | ||
|
||
public func body(content: Content) -> some View { | ||
HStack { | ||
content | ||
Button(action: { | ||
self.text = "" | ||
}) { | ||
Image(systemName: "xmark.circle.fill") | ||
.foregroundColor(.secondary) | ||
} | ||
} | ||
} | ||
} | ||
|
||
struct CustomSegmentedControl: View { | ||
@Binding var selectedInterval: Interval | ||
let intervals: [Interval] | ||
let color: LinearGradient | ||
|
||
var body: some View { | ||
HStack(spacing: 0) { | ||
ForEach(intervals.indices, id:\.self) { index in | ||
let isSelected = selectedInterval == intervals[index] | ||
ZStack { | ||
Rectangle() | ||
.fill(color.opacity(0.2)) | ||
|
||
Rectangle() | ||
.fill(color.opacity(0.8)) | ||
.cornerRadius(20) | ||
.padding(2) | ||
.opacity(isSelected ? 1 : 0.01) | ||
.onTapGesture { | ||
selectedInterval = intervals[index] | ||
} | ||
} | ||
.overlay( | ||
Text(Interval.intervalToString(intervals[index])) | ||
.font(.system(size: 14)) | ||
.fontWeight(isSelected ? .bold : .regular) | ||
.foregroundColor(isSelected ? .white : .gray) | ||
) | ||
} | ||
} | ||
.frame(height: 50) | ||
.cornerRadius(20) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters