@@ -15,36 +15,58 @@ extension FileManagerView {
1515 . filter { $0 != " ext " }
1616 }
1717
18+ var gradient : LinearGradient {
19+ LinearGradient (
20+ gradient: Gradient (
21+ stops: [
22+ Gradient . Stop ( color: . background, location: 0.2 ) ,
23+ Gradient . Stop ( color: . clear, location: 1 ) ,
24+ ]
25+ ) ,
26+ startPoint: . leading,
27+ endPoint: . trailing
28+ )
29+ }
30+
1831 var body : some View {
19- HStack ( spacing: 8 ) {
20- Image ( " SDCard " )
32+ HStack ( spacing: 0 ) {
33+ Image ( " SDCardDummy " )
2134 . resizable ( )
2235 . renderingMode ( . template)
23- . frame ( width: 24 , height: 24 )
36+ . frame ( width: 20 , height: 24 )
2437 . foregroundColor ( . primary)
2538 . onTapGesture { navigate ( to: 0 ) }
2639
27- Text ( " / " )
28- . font ( . system( size: 14 , weight: . bold) )
29- . foregroundColor ( . black30)
40+ ZStack ( alignment: . leading) {
41+ ScrollViewReader { proxy in
42+ ScrollView ( . horizontal, showsIndicators: false ) {
43+ HStack ( spacing: 8 ) {
44+ Spacer ( )
45+ . frame ( width: 0 , height: 0 )
3046
31- ScrollViewReader { proxy in
32- ScrollView ( . horizontal, showsIndicators: false ) {
33- HStack ( spacing: 8 ) {
34- ForEach ( components. indices, id: \. self) { index in
35- Element (
36- component: components [ index] ,
37- index: index,
38- onTap: navigate
39- )
47+ ForEach (
48+ components. indices,
49+ id: \. self
50+ ) { index in
51+ Element (
52+ component: components [ index] ,
53+ index: index,
54+ onTap: navigate
55+ )
56+ . id ( index)
57+ }
4058 }
4159 }
42- }
43- . onAppear {
44- if let lastIndex = components . indices . last {
45- proxy . scrollTo ( lastIndex , anchor : . trailing )
60+ . onAppear {
61+ if let lastIndex = components . indices . last {
62+ proxy . scrollTo ( lastIndex , anchor : . trailing )
63+ }
4664 }
4765 }
66+
67+ Rectangle ( )
68+ . fill ( gradient)
69+ . frame ( width: 8 , height: 24 )
4870 }
4971 }
5072 }
@@ -64,18 +86,36 @@ fileprivate extension FileManagerView.NavigationPathView {
6486
6587 var body : some View {
6688 HStack ( spacing: 8 ) {
67- if index != 0 {
68- Text ( " / " )
69- . font ( . system( size: 14 , weight: . bold) )
70- . foregroundColor ( . black30)
71- }
89+ Text ( " / " )
90+ . font ( . system( size: 14 , weight: . bold) )
91+ . foregroundColor ( . black30)
7292
7393 Text ( component)
7494 . font ( . system( size: 16 , weight: . bold) )
7595 . foregroundColor ( . primary)
7696 . onTapGesture { onTap ( index + 1 ) }
7797 }
78- . id ( index)
7998 }
8099 }
81100}
101+
102+ #Preview {
103+ VStack {
104+ FileManagerView . NavigationPathView (
105+ path: Peripheral . Path ( string: " /ext/apps " )
106+ )
107+
108+ FileManagerView . NavigationPathView (
109+ path: Peripheral . Path ( string: " /ext/Downloads/2021/08/17 " )
110+ )
111+
112+ FileManagerView . NavigationPathView (
113+ path: Peripheral . Path (
114+ string: " /ext/Downloads/2021/08/17/dummy/test/file "
115+ )
116+ )
117+ }
118+ . environment ( \. path, . constant( NavigationPath ( ) ) )
119+ . padding ( 12 )
120+ . background ( Color . background)
121+ }
0 commit comments