@@ -5,63 +5,68 @@ import SwiftUI
55struct Sidebar : View {
66 @Binding var selection : NavigationItem ?
77
8+ /// Namespace for glass effect morphing.
9+ @Namespace private var sidebarNamespace
10+
811 var body : some View {
9- List ( selection: self . $selection) {
10- // Main navigation
11- Section {
12- NavigationLink ( value: NavigationItem . search) {
13- Label ( " Search " , systemImage: " magnifyingglass " )
14- }
15- . accessibilityIdentifier ( AccessibilityID . Sidebar. searchItem)
12+ GlassEffectContainer ( spacing: 0 ) {
13+ List ( selection: self . $selection) {
14+ // Main navigation
15+ Section {
16+ NavigationLink ( value: NavigationItem . search) {
17+ Label ( " Search " , systemImage: " magnifyingglass " )
18+ }
19+ . accessibilityIdentifier ( AccessibilityID . Sidebar. searchItem)
1620
17- NavigationLink ( value: NavigationItem . home) {
18- Label ( " Home " , systemImage: " house " )
21+ NavigationLink ( value: NavigationItem . home) {
22+ Label ( " Home " , systemImage: " house " )
23+ }
24+ . accessibilityIdentifier ( AccessibilityID . Sidebar. homeItem)
1925 }
20- . accessibilityIdentifier ( AccessibilityID . Sidebar. homeItem)
21- }
2226
23- // Discover section
24- Section ( " Discover " ) {
25- NavigationLink ( value: NavigationItem . explore) {
26- Label ( " Explore " , systemImage: " globe " )
27- }
28- . accessibilityIdentifier ( AccessibilityID . Sidebar. exploreItem)
27+ // Discover section
28+ Section ( " Discover " ) {
29+ NavigationLink ( value: NavigationItem . explore) {
30+ Label ( " Explore " , systemImage: " globe " )
31+ }
32+ . accessibilityIdentifier ( AccessibilityID . Sidebar. exploreItem)
2933
30- NavigationLink ( value: NavigationItem . charts) {
31- Label ( " Charts " , systemImage: " chart.line.uptrend.xyaxis " )
32- }
33- . accessibilityIdentifier ( AccessibilityID . Sidebar. chartsItem)
34+ NavigationLink ( value: NavigationItem . charts) {
35+ Label ( " Charts " , systemImage: " chart.line.uptrend.xyaxis " )
36+ }
37+ . accessibilityIdentifier ( AccessibilityID . Sidebar. chartsItem)
3438
35- NavigationLink ( value: NavigationItem . moodsAndGenres) {
36- Label ( " Moods & Genres " , systemImage: " theatermask.and.paintbrush " )
37- }
38- . accessibilityIdentifier ( AccessibilityID . Sidebar. moodsAndGenresItem)
39+ NavigationLink ( value: NavigationItem . moodsAndGenres) {
40+ Label ( " Moods & Genres " , systemImage: " theatermask.and.paintbrush " )
41+ }
42+ . accessibilityIdentifier ( AccessibilityID . Sidebar. moodsAndGenresItem)
3943
40- NavigationLink ( value: NavigationItem . newReleases) {
41- Label ( " New Releases " , systemImage: " sparkles " )
44+ NavigationLink ( value: NavigationItem . newReleases) {
45+ Label ( " New Releases " , systemImage: " sparkles " )
46+ }
47+ . accessibilityIdentifier ( AccessibilityID . Sidebar. newReleasesItem)
4248 }
43- . accessibilityIdentifier ( AccessibilityID . Sidebar. newReleasesItem)
44- }
4549
46- // Library section
47- Section ( " Library " ) {
48- NavigationLink ( value: NavigationItem . likedMusic) {
49- Label ( " Liked Music " , systemImage: " heart.fill " )
50- }
51- . accessibilityIdentifier ( AccessibilityID . Sidebar. likedMusicItem)
50+ // Library section
51+ Section ( " Library " ) {
52+ NavigationLink ( value: NavigationItem . likedMusic) {
53+ Label ( " Liked Music " , systemImage: " heart.fill " )
54+ }
55+ . accessibilityIdentifier ( AccessibilityID . Sidebar. likedMusicItem)
5256
53- NavigationLink ( value: NavigationItem . library) {
54- Label ( " Playlists " , systemImage: " music.note.list " )
57+ NavigationLink ( value: NavigationItem . library) {
58+ Label ( " Playlists " , systemImage: " music.note.list " )
59+ }
60+ . accessibilityIdentifier ( AccessibilityID . Sidebar. libraryItem)
5561 }
56- . accessibilityIdentifier ( AccessibilityID . Sidebar. libraryItem)
5762 }
58- }
59- . listStyle ( . sidebar )
60- . navigationSplitViewColumnWidth ( min : 200 , ideal : 220 , max : 300 )
61- . accessibilityIdentifier ( AccessibilityID . Sidebar . container )
62- . onChange ( of : self . selection ) { _ , newValue in
63- if newValue != nil {
64- HapticService . navigation ( )
63+ . listStyle ( . sidebar )
64+ . navigationSplitViewColumnWidth ( min : 200 , ideal : 220 , max : 300 )
65+ . accessibilityIdentifier ( AccessibilityID . Sidebar . container )
66+ . onChange ( of : self . selection ) { _ , newValue in
67+ if newValue != nil {
68+ HapticService . navigation ( )
69+ }
6570 }
6671 }
6772 }
0 commit comments