aboutsummaryrefslogtreecommitdiff
path: root/Map/Presentation/Base Components/EvolutionPicker/EvolutionPickerMenu.swift
blob: 3a396aa92ca14d1f19acc51ac37ed499e1e30e08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import SwiftUI

struct EvolutionPickerMenu: View {

  @Binding var selectedEvolution: StageType

  private func select(_ evolution: StageType) {
    selectedEvolution = evolution
  }

  var body: some View {
    VStack(alignment: .leading, spacing: 1.0) {
      Section(header: EvolutionPickerMenuHeader(key: "stage_type.section.types")) {
        ForEach(StageType.types) { stage in
          EvolutionPickerMenuItem(stage: stage, isSelected: selectedEvolution == stage)
            .onTapGesture {
              selectedEvolution = stage
            }
        }
      }
      Section(header: EvolutionPickerMenuHeader(key: "stage_type.section.characteristics")) {
        ForEach(StageType.characteristics) { stage in
          EvolutionPickerMenuItem(stage: stage, isSelected: selectedEvolution == stage)
            .onTapGesture {
              selectedEvolution = stage
            }
        }
      }
      Section(header: EvolutionPickerMenuHeader(key: "stage_type.section.general_properties")) {
        ForEach(StageType.properties) { stage in
          EvolutionPickerMenuItem(stage: stage, isSelected: selectedEvolution == stage)
            .onTapGesture {
              selectedEvolution = stage
            }
        }
      }
      Section(header: EvolutionPickerMenuHeader(key: "stage_type.section.other")) {
        ForEach(StageType.custom) { stage in
          EvolutionPickerMenuItem(stage: stage, isSelected: selectedEvolution == stage)
            .onTapGesture {
              selectedEvolution = stage
            }
        }
      }
    }
    .padding(Dimensions.Spacing.coziest)
    .ignoresSafeArea()

  }
}

#Preview {
  EvolutionPickerMenu(selectedEvolution: .constant(.ubiquity))
}

/*
Picker(selection: $selectedEvolution) {
  Divider()
  ForEach(StageType.characteristics) { stage in
    Text(Stage.title(stage))
      .font(selectedEvolution == stage ? .Theme.Body.emphasized : .Theme.Body.regular)
      .tag(stage)
  }
  Divider()
  ForEach(StageType.properties) { stage in
    Text(Stage.title(stage))
      .font(selectedEvolution == stage ? .Theme.Body.emphasized : .Theme.Body.regular)
      .tag(stage)
  }
  Divider()
  ForEach(StageType.custom) { stage in
    Text(Stage.title(stage))
      .font(selectedEvolution == stage ? .Theme.Body.emphasized : .Theme.Body.regular)
      .tag(stage)
  }
} label: {
 Label("evolution_picker.label", image: "Icons/Evolution")
    .font(.Theme.Body.regular)
}.padding(.horizontal, Dimensions.Spacing.regular)
  .padding(.vertical, Dimensions.Spacing.cozy)
 */