diff options
Diffstat (limited to 'Map/Presentation')
| -rw-r--r-- | Map/Presentation/Base Components/EvolutionPicker.swift | 11 | ||||
| -rw-r--r-- | Map/Presentation/Base Components/MapRender/MapAxes.swift | 16 | ||||
| -rw-r--r-- | Map/Presentation/Base Components/MapRender/MapNotes.swift | 6 | ||||
| -rw-r--r-- | Map/Presentation/Base Components/MapRender/MapVertices.swift | 6 | ||||
| -rw-r--r-- | Map/Presentation/Base Components/MapTextEditor.swift | 2 | ||||
| -rw-r--r-- | Map/Presentation/Base Components/SearchBar.swift | 6 | ||||
| -rw-r--r-- | Map/Presentation/Complex Components/MapRender/MapRenderView.swift | 4 | ||||
| -rw-r--r-- | Map/Presentation/EvolutionPicker.swift | 41 | ||||
| -rw-r--r-- | Map/Presentation/MapEditor.swift | 10 | ||||
| -rw-r--r-- | Map/Presentation/Theme/Color+theme.swift | 17 | ||||
| -rw-r--r-- | Map/Presentation/Theme/Dimensions.swift | 46 | ||||
| -rw-r--r-- | Map/Presentation/Theme/Font+theme.swift | 41 | ||||
| -rw-r--r-- | Map/Presentation/Theme/LibertinusSerif-Regular.otf | bin | 0 -> 337132 bytes | |||
| -rw-r--r-- | Map/Presentation/Theme/Ronzino-Medium.otf | bin | 0 -> 61604 bytes | |||
| -rw-r--r-- | Map/Presentation/Theme/Ronzino-Regular.otf | bin | 0 -> 59968 bytes |
15 files changed, 128 insertions, 78 deletions
diff --git a/Map/Presentation/Base Components/EvolutionPicker.swift b/Map/Presentation/Base Components/EvolutionPicker.swift index 2768540..2df4a7f 100644 --- a/Map/Presentation/Base Components/EvolutionPicker.swift +++ b/Map/Presentation/Base Components/EvolutionPicker.swift @@ -21,21 +21,22 @@ struct EvolutionPicker: View { var body: some View { Picker("Evolution", selection: $selectedEvolution) { ForEach(StageType.types) { stage in - Text(Stage.title(stage)).font(.Theme.body).tag(stage).padding(4.0) + Text(Stage.title(stage)).font(.Theme.Body.regular).tag(stage).padding(4.0) } Divider() ForEach(StageType.characteristics) { stage in - Text(Stage.title(stage)).font(.Theme.body).tag(stage).padding(4.0).font(.Theme.body) + Text(Stage.title(stage)).font(.Theme.Body.regular).tag(stage).padding(4.0).font( + .Theme.Body.regular) } Divider() ForEach(StageType.properties) { stage in - Text(Stage.title(stage)).font(.Theme.body).tag(stage).padding(4.0) + Text(Stage.title(stage)).font(.Theme.Body.regular).tag(stage).padding(4.0) } Divider() ForEach(StageType.custom) { stage in - Text(Stage.title(stage)).font(.Theme.body).tag(stage).padding(4.0) + Text(Stage.title(stage)).font(.Theme.Body.regular).tag(stage).padding(4.0) } - }.font(.Theme.body).padding(.horizontal, 8.0).padding(.vertical, 4.0) + }.font(.Theme.Body.regular).padding(.horizontal, 8.0).padding(.vertical, 4.0) } } diff --git a/Map/Presentation/Base Components/MapRender/MapAxes.swift b/Map/Presentation/Base Components/MapRender/MapAxes.swift index 4f64135..1c0a147 100644 --- a/Map/Presentation/Base Components/MapRender/MapAxes.swift +++ b/Map/Presentation/Base Components/MapRender/MapAxes.swift @@ -36,11 +36,11 @@ struct MapAxes: View { }.stroke(Color.Map.axisColor, lineWidth: lineWidth * 2) // Y Labels - Text("Visible").font(.Theme.axisLabel).foregroundColor(.Map.labelColor).rotationEffect( + Text("Visible").font(.Theme.Map.axisLabel).foregroundColor(.Map.labelColor).rotationEffect( Angle(degrees: -90.0) ) .offset(CGSize(width: -35.0, height: 0.0)) - Text("Invisible").font(.Theme.axisLabel).foregroundColor(.Map.labelColor).rotationEffect( + Text("Invisible").font(.Theme.Map.axisLabel).foregroundColor(.Map.labelColor).rotationEffect( Angle(degrees: -90.0) ) .offset(CGSize(width: -40.0, height: mapSize.height - 20)) @@ -48,36 +48,36 @@ struct MapAxes: View { // X Labels Text("Uncharted") - .font(.Theme.axisLabel) + .font(.Theme.Map.axisLabel) .foregroundColor(.Map.labelColor) .frame(width: mapSize.width / 4, height: stageHeight / 2.0, alignment: .topLeading) .offset(CGSize(width: 0.0, height: -stageHeight / 4.0)) Text("Industrialised") - .font(.Theme.axisLabel) + .font(.Theme.Map.axisLabel) .foregroundColor(.Map.labelColor) .frame(width: mapSize.width / 4, height: stageHeight / 2.0, alignment: .topLeading) .offset(CGSize(width: mapSize.width - 100.0, height: -stageHeight / 4.0)) Text(evolution.i) - .font(.Theme.axisLabel) + .font(.Theme.Map.axisLabel) .foregroundColor(.Map.labelColor) .frame(width: w(stages[0]), height: stageHeight, alignment: .topLeading) .offset(CGSize(width: 0.0, height: mapSize.height + padding)) Text(evolution.ii) - .font(.Theme.axisLabel) + .font(.Theme.Map.axisLabel) .foregroundColor(.Map.labelColor) .frame(width: w(stages[1]) - w(stages[0]), height: stageHeight, alignment: .topLeading) .offset(CGSize(width: w(stages[0]), height: mapSize.height + padding)) Text(evolution.iii) - .font(.Theme.axisLabel) + .font(.Theme.Map.axisLabel) .foregroundColor(.Map.labelColor) .frame(width: w(stages[2]) - w(stages[1]), height: stageHeight, alignment: .topLeading) .offset(CGSize(width: w(stages[1]), height: mapSize.height + padding)) Text(evolution.iv) - .font(.Theme.axisLabel) + .font(.Theme.Map.axisLabel) .foregroundColor(.Map.labelColor) .frame(width: mapSize.width - w(stages[2]), height: stageHeight, alignment: .topLeading) .offset(CGSize(width: w(stages[2]), height: mapSize.height + padding)) diff --git a/Map/Presentation/Base Components/MapRender/MapNotes.swift b/Map/Presentation/Base Components/MapRender/MapNotes.swift index 0119154..16c61ba 100644 --- a/Map/Presentation/Base Components/MapRender/MapNotes.swift +++ b/Map/Presentation/Base Components/MapRender/MapNotes.swift @@ -24,8 +24,10 @@ struct MapNotes: View { var body: some View { ForEach(notes, id: \.id) { note in - Text(note.text.replacingOccurrences(of: "\\n", with: "\n")).font(.Theme.note) - .padding(2.0) + Text(note.text.replacingOccurrences(of: "\\n", with: "\n")) + .font(.Theme.Map.note) + .lineSpacing(Dimensions.LineHeight.Map.note - Dimensions.FontSize.Map.note) + .padding(Dimensions.Spacing.cozy) .background(.white) .foregroundColor(.Map.labelColor) .border(Color.Map.vertexColor, width: lineWidth) diff --git a/Map/Presentation/Base Components/MapRender/MapVertices.swift b/Map/Presentation/Base Components/MapRender/MapVertices.swift index d8e3b88..1f6cf1a 100644 --- a/Map/Presentation/Base Components/MapRender/MapVertices.swift +++ b/Map/Presentation/Base Components/MapRender/MapVertices.swift @@ -28,7 +28,11 @@ struct MapVertices: View { ForEach(vertices, id: \.id) { vertex in ZStack(alignment: .topLeading) { getVertexShape(vertex).fill(Color.Map.vertexColor) - Text(vertex.label.replacingOccurrences(of: "\\n", with: "\n")).font(.Theme.vertexLabel) + Text(vertex.label.replacingOccurrences(of: "\\n", with: "\n")) + .font(.Theme.Map.vertexLabel) + .lineSpacing( + Dimensions.LineHeight.Map.vertexLabel - Dimensions.FontSize.Map.vertexLabel + ) .foregroundColor(.Map.labelColor) .shadow(color: .white, radius: 0, x: -0.5, y: -0.5) .shadow(color: .white, radius: 0, x: 0.5, y: 0.5) diff --git a/Map/Presentation/Base Components/MapTextEditor.swift b/Map/Presentation/Base Components/MapTextEditor.swift index ff98203..3c5c824 100644 --- a/Map/Presentation/Base Components/MapTextEditor.swift +++ b/Map/Presentation/Base Components/MapTextEditor.swift @@ -150,7 +150,7 @@ extension MapTextEditorController: NSTextStorageDelegate { } } - private func colorizeText(textStorage: NSTextStorage) { + nonisolated private func colorizeText(textStorage: NSTextStorage) { let range = NSMakeRange(0, textStorage.length) var matches = vertexRegex.matches(in: textStorage.string, options: [], range: range) diff --git a/Map/Presentation/Base Components/SearchBar.swift b/Map/Presentation/Base Components/SearchBar.swift index e5182c5..cd2c378 100644 --- a/Map/Presentation/Base Components/SearchBar.swift +++ b/Map/Presentation/Base Components/SearchBar.swift @@ -48,19 +48,19 @@ struct SearchBar: View { Spacer() Button(action: onPrevious) { Image(systemName: "chevron.left") - .font(.Theme.smallControl) + .font(.Theme.SmallControl.regular) }.keyboardShortcut( "g", modifiers: EventModifiers([.command, .shift]) ).help("Find Previous (⇧⌘G)") Button(action: onNext) { Image(systemName: "chevron.right") - .font(.Theme.smallControl) + .font(.Theme.SmallControl.regular) }.keyboardShortcut( "g", modifiers: EventModifiers([.command]) ).help("Find Next (⌘G)") Button(action: onDismiss) { Text("Done") - .font(.Theme.smallControl) + .font(.Theme.SmallControl.regular) }.keyboardShortcut(.escape, modifiers: EventModifiers()) .help("Done (⎋)") }.padding(4.0) diff --git a/Map/Presentation/Complex Components/MapRender/MapRenderView.swift b/Map/Presentation/Complex Components/MapRender/MapRenderView.swift index 1ca1ffe..780290b 100644 --- a/Map/Presentation/Complex Components/MapRender/MapRenderView.swift +++ b/Map/Presentation/Complex Components/MapRender/MapRenderView.swift @@ -30,8 +30,8 @@ struct MapRenderView: View { MapParser.parse(content: document.text) } - let mapSize = Dimensions.mapSize - let padding = Dimensions.mapPadding + let mapSize = Dimensions.Map.size + let padding = Dimensions.Map.padding let lineWidth = CGFloat(0.5) let vertexSize = CGSize(width: 25.0, height: 25.0) diff --git a/Map/Presentation/EvolutionPicker.swift b/Map/Presentation/EvolutionPicker.swift deleted file mode 100644 index 0f4c954..0000000 --- a/Map/Presentation/EvolutionPicker.swift +++ /dev/null @@ -1,41 +0,0 @@ -import SwiftUI - -struct EvolutionPicker: View { - - @EnvironmentObject private var store: AppStore - - private var selectedEvolution: Binding<StageType> { - Binding( - get: { store.state.selectedEvolution }, - set: { evolution in - store.send(.selectEvolution(evolution: evolution)) - } - ) - } - - var body: some View { - Picker("Evolution", selection: selectedEvolution) { - ForEach(StageType.types) { stage in - Text(Stage.title(stage)).font(.theme.body).tag(stage).padding(4.0) - } - Divider() - ForEach(StageType.characteristics) { stage in - Text(Stage.title(stage)).font(.theme.body).tag(stage).padding(4.0).font(.theme.body) - } - Divider() - ForEach(StageType.properties) { stage in - Text(Stage.title(stage)).font(.theme.body).tag(stage).padding(4.0) - } - Divider() - ForEach(StageType.custom) { stage in - Text(Stage.title(stage)).font(.theme.body).tag(stage).padding(4.0) - } - }.font(.theme.body).padding(.horizontal, 8.0).padding(.vertical, 4.0) - } -} - -struct EvolutionPicker_Previews: PreviewProvider { - static var previews: some View { - EvolutionPicker() - } -} diff --git a/Map/Presentation/MapEditor.swift b/Map/Presentation/MapEditor.swift index 5cda8f9..1e25ce8 100644 --- a/Map/Presentation/MapEditor.swift +++ b/Map/Presentation/MapEditor.swift @@ -102,8 +102,8 @@ struct MapEditor: View { MapRenderView( document: $document, evolution: $selectedEvolution, onDragVertex: onDragVertex ).scaleEffect(zoom, anchor: .center).frame( - width: (Dimensions.mapSize.width + 2 * Dimensions.mapPadding) * zoom, - height: (Dimensions.mapSize.height + 2 * Dimensions.mapPadding) * zoom) + width: (Dimensions.Map.size.width + 2 * Dimensions.Map.padding) * zoom, + height: (Dimensions.Map.size.height + 2 * Dimensions.Map.padding) * zoom) }.background(Color.UI.background) .gesture( MagnificationGesture() @@ -125,16 +125,16 @@ struct MapEditor: View { value: $zoom, in: zoomRange, step: 0.1, label: { Text(formatZoom(zoom)) - .font(.Theme.smallControl) + .font(.Theme.SmallControl.regular) }, minimumValueLabel: { Image(systemName: "minus.magnifyingglass") - .font(.Theme.smallControl) + .font(.Theme.SmallControl.regular) .help("Zoom Out (⌘-)") }, maximumValueLabel: { Image(systemName: "plus.magnifyingglass") - .font(.Theme.smallControl) + .font(.Theme.SmallControl.regular) .help("Zoom In (⌘+)") } ).frame(width: 200).padding(.trailing, 10.0) diff --git a/Map/Presentation/Theme/Color+theme.swift b/Map/Presentation/Theme/Color+theme.swift index feac76a..ee80e82 100644 --- a/Map/Presentation/Theme/Color+theme.swift +++ b/Map/Presentation/Theme/Color+theme.swift @@ -16,6 +16,9 @@ import SwiftUI extension Color { struct Theme { + + // MARK: - Base Palette + static let darkSlate = Color("Dark Slate") static let jasperRed = Color("Jasper Red") static let olympicBlue = Color("Olympic Blue") @@ -28,6 +31,15 @@ extension Color { static let darkerNeutralGray = Color("Darker Neutral Gray") } + // MARK: - General + + struct UI { + static let foreground = Color("Foreground") + static let background = Color("Background") + } + + // MARK: - The Map + struct Map { static let labelColor = Color.Theme.darkSlate static let axisColor = Color.Theme.darkSlate @@ -44,9 +56,4 @@ extension Color { Color.Theme.hermosaPink, ] } - - struct UI { - static let foreground = Color("Foreground") - static let background = Color("Background") - } } diff --git a/Map/Presentation/Theme/Dimensions.swift b/Map/Presentation/Theme/Dimensions.swift index 99a6207..2e1fd69 100644 --- a/Map/Presentation/Theme/Dimensions.swift +++ b/Map/Presentation/Theme/Dimensions.swift @@ -15,6 +15,48 @@ import Foundation struct Dimensions { - static let mapSize = CGSize(width: 1300.0, height: 1000.0) - static let mapPadding: CGFloat = 42.0 + + // MARK: - Fonts + + struct FontSize { + static let body: CGFloat = 16 + static let title: CGFloat = 32 + static let caption: CGFloat = 14 + static let smallControl: CGFloat = 9 + + struct Map { + static let note: CGFloat = 12 + static let axisLabel: CGFloat = 14 + static let vertexLabel: CGFloat = 12 + } + } + + struct LineHeight { + static let body: CGFloat = 18 + static let title: CGFloat = 38 + static let caption: CGFloat = 18 + static let smallControl: CGFloat = 18 + + struct Map { + static let note: CGFloat = 18 + static let axisLabel: CGFloat = 18 + static let vertexLabel: CGFloat = 18 + } + } + + // MARK: - Spacing + + struct Spacing { + static let coziest: CGFloat = 3.0 + static let cozy: CGFloat = 5.0 + static let regular: CGFloat = 8.0 + static let loose: CGFloat = 12.0 + static let indulgent: CGFloat = 16.0 + } + + // MARK: - The Map + struct Map { + static let size = CGSize(width: 1300.0, height: 1000.0) + static let padding: CGFloat = 42.0 + } } diff --git a/Map/Presentation/Theme/Font+theme.swift b/Map/Presentation/Theme/Font+theme.swift index 1a9abb8..2fb56f7 100644 --- a/Map/Presentation/Theme/Font+theme.swift +++ b/Map/Presentation/Theme/Font+theme.swift @@ -15,6 +15,19 @@ import SwiftUI extension Font { + + static func libertinus(size: CGFloat) -> Font { + return .custom("Libertinus Serif", size: size) + } + + static func ronzino(size: CGFloat) -> Font { + return .custom("Ronzino", size: size) + } + + static func ronzinoMedium(size: CGFloat) -> Font { + return .custom("RonzinoMedium", size: size) + } + public struct Theme { // Map @@ -22,8 +35,30 @@ extension Font { static let axisLabel = Font.system(size: 14, design: .serif) static let vertexLabel = Font.system(size: 12, design: .serif) - // UI - static let smallControl = Font.system(size: 9) - static let body = Font.system(size: 13) + struct Body { + static let regular = Font.ronzino(size: Dimensions.FontSize.body).weight(.regular) + static let emphasized = Font.ronzino(size: Dimensions.FontSize.body).weight(.medium) + } + + struct Title { + static let emphasized = Font.libertinus(size: Dimensions.FontSize.title).weight(.medium) + } + + struct Caption { + static let regular = Font.ronzino(size: Dimensions.FontSize.caption).weight(.regular) + static let emphasized = Font.ronzino(size: Dimensions.FontSize.caption).weight(.medium) + } + + struct SmallControl { + static let regular = Font.ronzino(size: Dimensions.FontSize.smallControl).weight(.regular) + } + + struct Map { + static let note = Font.libertinus(size: Dimensions.FontSize.Map.note).weight(.regular) + static let axisLabel = Font.libertinus(size: Dimensions.FontSize.Map.axisLabel).weight( + .regular) + static let vertexLabel = Font.libertinus(size: Dimensions.FontSize.Map.vertexLabel).weight( + .regular) + } } } diff --git a/Map/Presentation/Theme/LibertinusSerif-Regular.otf b/Map/Presentation/Theme/LibertinusSerif-Regular.otf Binary files differnew file mode 100644 index 0000000..508f3c0 --- /dev/null +++ b/Map/Presentation/Theme/LibertinusSerif-Regular.otf diff --git a/Map/Presentation/Theme/Ronzino-Medium.otf b/Map/Presentation/Theme/Ronzino-Medium.otf Binary files differnew file mode 100644 index 0000000..0be8dd5 --- /dev/null +++ b/Map/Presentation/Theme/Ronzino-Medium.otf diff --git a/Map/Presentation/Theme/Ronzino-Regular.otf b/Map/Presentation/Theme/Ronzino-Regular.otf Binary files differnew file mode 100644 index 0000000..8b70471 --- /dev/null +++ b/Map/Presentation/Theme/Ronzino-Regular.otf |