From e21ead77ffdff206d1ae17e5ce93ea34c4227414 Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Fri, 4 Jul 2025 22:45:30 +0200 Subject: Add new fonts and picker style. --- .../EvolutionPicker/EvolutionPickerMenu.swift | 81 ++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 Map/Presentation/Base Components/EvolutionPicker/EvolutionPickerMenu.swift (limited to 'Map/Presentation/Base Components/EvolutionPicker/EvolutionPickerMenu.swift') diff --git a/Map/Presentation/Base Components/EvolutionPicker/EvolutionPickerMenu.swift b/Map/Presentation/Base Components/EvolutionPicker/EvolutionPickerMenu.swift new file mode 100644 index 0000000..3a396aa --- /dev/null +++ b/Map/Presentation/Base Components/EvolutionPicker/EvolutionPickerMenu.swift @@ -0,0 +1,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) + */ -- cgit