Skip to content

Commit

Permalink
[동주] TabView 상단 SlideTabView 일부 디자인 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
yoondj98 committed Aug 11, 2024
1 parent fee3ed7 commit 219d86b
Showing 1 changed file with 9 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ public struct SlidingTabView : View {

let tabs: [String]

public init(selection: Binding<Int>,
tabs: [String]) {
self._selection = selection
self.tabs = tabs
}

public var body: some View {
VStack(alignment: .leading, spacing: 0) {
HStack(spacing: 0) {
Expand All @@ -40,7 +34,12 @@ public struct SlidingTabView : View {
}
}
GeometryReader { geometry in
ZStack(alignment: .leading) {
ZStack(alignment: .bottomLeading) {
Rectangle()
.fill(.placeholderGray)
.frame(width: geometry.size.width,
height: 1,
alignment: .leading)
Rectangle()
.fill(.primaryPurple)
.frame(width: self.tabWidth(from: geometry.size.width),
Expand All @@ -49,14 +48,9 @@ public struct SlidingTabView : View {
.offset(x: self.selectionBarXOffset(from: geometry.size.width),
y: 0)
.animation(.bouncy, value: selection)
Rectangle()
.fill(.placeholderGray)
.frame(width: geometry.size.width,
height: 1,
alignment: .leading)
}.fixedSize(horizontal: false, vertical: true)
}.fixedSize(horizontal: false, vertical: true)

}
}
.frame(height: 2)
}
}

Expand All @@ -66,7 +60,6 @@ public struct SlidingTabView : View {
}

private func selectionBarXOffset(from totalWidth: CGFloat) -> CGFloat {
print(selection)
return self.tabWidth(from: totalWidth) * CGFloat(selection)
}

Expand Down

0 comments on commit 219d86b

Please sign in to comment.