@@ -4,49 +4,56 @@ struct EditCardMenuContent: View {
44 let cardViewModel : TrafficCardViewModel
55
66 var body : some View {
7- Section {
8- Menu {
9- ControlGroup {
10- Button {
11- cardViewModel. configurationDelegate? . moveCard ( cardViewModel, direction: . up)
12- } label: {
13- Label ( Strings . Buttons. moveUp, systemImage: " arrow.up " )
14- }
7+ if cardViewModel. configurationDelegate != nil {
8+ Section {
9+ contents
10+ }
11+ }
12+ }
1513
16- Button {
17- cardViewModel. configurationDelegate? . moveCard ( cardViewModel, direction: . top)
18- } label: {
19- Label ( Strings . Buttons. moveToTop, systemImage: " arrow.up.to.line " )
20- }
14+ @ViewBuilder
15+ private var contents : some View {
16+ Menu {
17+ ControlGroup {
18+ Button {
19+ cardViewModel. configurationDelegate? . moveCard ( cardViewModel, direction: . up)
20+ } label: {
21+ Label ( Strings . Buttons. moveUp, systemImage: " arrow.up " )
2122 }
2223
23- ControlGroup {
24- Button {
25- cardViewModel. configurationDelegate? . moveCard ( cardViewModel, direction: . down)
26- } label: {
27- Label ( Strings . Buttons. moveDown, systemImage: " arrow.down " )
28- }
29-
30- Button {
31- cardViewModel. configurationDelegate? . moveCard ( cardViewModel, direction: . bottom)
32- } label: {
33- Label ( Strings . Buttons. moveToBottom, systemImage: " arrow.down.to.line " )
34- }
24+ Button {
25+ cardViewModel. configurationDelegate? . moveCard ( cardViewModel, direction: . top)
26+ } label: {
27+ Label ( Strings . Buttons. moveToTop, systemImage: " arrow.up.to.line " )
3528 }
36- } label: {
37- Label ( Strings . Buttons. moveCard, systemImage: " arrow.up.arrow.down " )
38- }
39- Button {
40- cardViewModel. isEditing = true
41- } label: {
42- Label ( Strings . Buttons. customize, systemImage: " widget.small " )
4329 }
44- Button ( role: . destructive) {
45- cardViewModel. configurationDelegate? . deleteCard ( cardViewModel)
46- } label: {
47- Label ( Strings . Buttons. deleteWidget, systemImage: " trash " )
48- . tint ( Color . red)
30+
31+ ControlGroup {
32+ Button {
33+ cardViewModel. configurationDelegate? . moveCard ( cardViewModel, direction: . down)
34+ } label: {
35+ Label ( Strings . Buttons. moveDown, systemImage: " arrow.down " )
36+ }
37+
38+ Button {
39+ cardViewModel. configurationDelegate? . moveCard ( cardViewModel, direction: . bottom)
40+ } label: {
41+ Label ( Strings . Buttons. moveToBottom, systemImage: " arrow.down.to.line " )
42+ }
4943 }
44+ } label: {
45+ Label ( Strings . Buttons. moveCard, systemImage: " arrow.up.arrow.down " )
46+ }
47+ Button {
48+ cardViewModel. isEditing = true
49+ } label: {
50+ Label ( Strings . Buttons. customize, systemImage: " widget.small " )
51+ }
52+ Button ( role: . destructive) {
53+ cardViewModel. configurationDelegate? . deleteCard ( cardViewModel)
54+ } label: {
55+ Label ( Strings . Buttons. deleteWidget, systemImage: " trash " )
56+ . tint ( Color . red)
5057 }
5158 }
5259}
0 commit comments