From c9ab73c4ae6a2f8bae5d76081cdf21a0b0f7070b Mon Sep 17 00:00:00 2001 From: Christoph Hagen Date: Wed, 23 Aug 2023 16:17:34 +0200 Subject: [PATCH] Specify accent color in style --- ResumeBuilder/CV.swift | 12 ++++++--- ResumeBuilder/ContentView.swift | 4 ++- ResumeBuilder/Data.swift | 1 + .../Elements/CareerStationView.swift | 27 ++++++++++--------- ResumeBuilder/Elements/PublicationView.swift | 7 +++-- .../Generic Elements/LeftImageLabel.swift | 2 +- .../Generic Elements/RightImageLabel.swift | 4 +-- .../Main Elements/TitledCareerSection.swift | 6 ++++- ResumeBuilder/Main Elements/TopView.swift | 8 +++--- ResumeBuilder/Style/CVStyle.swift | 2 ++ 10 files changed, 48 insertions(+), 25 deletions(-) diff --git a/ResumeBuilder/CV.swift b/ResumeBuilder/CV.swift index 96f7122..d33447c 100644 --- a/ResumeBuilder/CV.swift +++ b/ResumeBuilder/CV.swift @@ -12,10 +12,13 @@ struct CV: View { var body: some View { VStack { - TopView(info: info.top, style: style.header) + TopView( + info: info.top, + style: style.header, + accent: style.accentColor) .frame(height: style.header.height) Rectangle() - .fill(Color.accentColor) + .fill(style.accentColor) .frame(height: style.header.lineWidth) GeometryReader { geo in let columnWidth = max(0, (geo.size.width - twoColumnSpacing)) / 2 @@ -23,9 +26,11 @@ struct CV: View { VStack(alignment: .leading) { TitledCareerSection( style: style.section, + accent: style.accentColor, content: info.work) TitledCareerSection( style: style.section, + accent: style.accentColor, content: info.education) }.frame(width: columnWidth) VStack(alignment: .leading) { @@ -36,7 +41,8 @@ struct CV: View { PublicationView( info: item, borderSpacing: style.section.borderSpacing, - borderWidth: style.section.borderWidth) + borderWidth: style.section.borderWidth, + accent: style.accentColor) .padding(.bottom, style.section.bottomSpacing) } } diff --git a/ResumeBuilder/ContentView.swift b/ResumeBuilder/ContentView.swift index 497a171..380064a 100644 --- a/ResumeBuilder/ContentView.swift +++ b/ResumeBuilder/ContentView.swift @@ -59,7 +59,9 @@ struct ContentView: View { Toggle("Dark mode", isOn: $darkModeEnabled) .toggleStyle(SwitchToggleStyle()) } - .padding() + .padding([.top, .trailing]) + .padding(.leading, 6) + .padding(.bottom, 4) ScrollView(.vertical) { CV(info: info, style: style) }.frame(width: style.pageWidth) diff --git a/ResumeBuilder/Data.swift b/ResumeBuilder/Data.swift index d2c521e..a42612b 100644 --- a/ResumeBuilder/Data.swift +++ b/ResumeBuilder/Data.swift @@ -3,6 +3,7 @@ import SwiftUI let cvStyle = CVStyle( pageWidth: 600, + accentColor: .init(244, 144, 0), header: HeaderStyle( height: 100, lineWidth: 1, diff --git a/ResumeBuilder/Elements/CareerStationView.swift b/ResumeBuilder/Elements/CareerStationView.swift index 59d005c..7a4dea4 100644 --- a/ResumeBuilder/Elements/CareerStationView.swift +++ b/ResumeBuilder/Elements/CareerStationView.swift @@ -9,14 +9,15 @@ struct CareerStationView: View { let borderWidth: CGFloat + let accent: Color + var body: some View { - LeftBorderView(color: .accentColor, spacing: borderSpacing, borderWidth: borderWidth) { + LeftBorderView(color: accent, spacing: borderSpacing, borderWidth: borderWidth) { VStack(alignment: .leading) { HStack { RightImageLabel(info.time, systemSymbol: .calendar) - .padding(.leading, -4) Spacer() - RightImageLabel(info.location, systemSymbol: .pin) + RightImageLabel(info.location, systemSymbol: .house) } .font(.caption) .foregroundColor(.secondary) @@ -26,7 +27,7 @@ struct CareerStationView: View { if let subtitle = info.subtitle { Text(subtitle) .font(.subheadline) - .foregroundColor(.accentColor) + .foregroundColor(accent) } if let text = info.text { Text(text) @@ -40,14 +41,16 @@ struct CareerStationView: View { struct CareerStationView_Previews: PreviewProvider { static var previews: some View { - CareerStationView(info: .init( - time: "Jul 2020 - Jul 2023", - location: "Braunschweig, Germany", - title: "German Aerospace Center", - subtitle: "Systems engineer", - text: "Responsible for aircraft systems and avionics of a high-altitude solar drone, safety, and software."), - borderSpacing: 5, - borderWidth: 3) + CareerStationView( + info: .init( + time: "Jul 2020 - Jul 2023", + location: "Braunschweig, Germany", + title: "German Aerospace Center", + subtitle: "Systems engineer", + text: "Responsible for aircraft systems and avionics of a high-altitude solar drone, safety, and software."), + borderSpacing: 5, + borderWidth: 3, + accent: .orange) .previewLayout(.fixed(width: 300, height: 100)) } } diff --git a/ResumeBuilder/Elements/PublicationView.swift b/ResumeBuilder/Elements/PublicationView.swift index fa443ab..177c862 100644 --- a/ResumeBuilder/Elements/PublicationView.swift +++ b/ResumeBuilder/Elements/PublicationView.swift @@ -8,8 +8,10 @@ struct PublicationView: View { let borderWidth: CGFloat + let accent: Color + var body: some View { - LeftBorderView(color: .accentColor, spacing: borderSpacing, borderWidth: borderWidth) { + LeftBorderView(color: accent, spacing: borderSpacing, borderWidth: borderWidth) { VStack(alignment: .leading) { Text(info.venue) .font(.caption) @@ -28,6 +30,7 @@ struct PublicationView_Previews: PreviewProvider { venue: "My venue", title: "The publication title"), borderSpacing: 5, - borderWidth: 3) + borderWidth: 3, + accent: .orange) } } diff --git a/ResumeBuilder/Generic Elements/LeftImageLabel.swift b/ResumeBuilder/Generic Elements/LeftImageLabel.swift index c13dedc..79b0ca6 100644 --- a/ResumeBuilder/Generic Elements/LeftImageLabel.swift +++ b/ResumeBuilder/Generic Elements/LeftImageLabel.swift @@ -13,7 +13,7 @@ struct LeftImageLabel: View { } var body: some View { - HStack(spacing: 0) { + HStack(alignment: .firstTextBaseline, spacing: 0) { Text(text) Image(systemSymbol: systemSymbol) .frame(width: 20) diff --git a/ResumeBuilder/Generic Elements/RightImageLabel.swift b/ResumeBuilder/Generic Elements/RightImageLabel.swift index f41e62d..847fda1 100644 --- a/ResumeBuilder/Generic Elements/RightImageLabel.swift +++ b/ResumeBuilder/Generic Elements/RightImageLabel.swift @@ -13,9 +13,9 @@ struct RightImageLabel: View { } var body: some View { - HStack(spacing: 0) { + HStack(alignment: .firstTextBaseline, spacing: 3) { Image(systemSymbol: systemSymbol) - .frame(width: 20) + .aspectRatio(1, contentMode: .fill) Text(text) } } diff --git a/ResumeBuilder/Main Elements/TitledCareerSection.swift b/ResumeBuilder/Main Elements/TitledCareerSection.swift index d5017c5..6c69967 100644 --- a/ResumeBuilder/Main Elements/TitledCareerSection.swift +++ b/ResumeBuilder/Main Elements/TitledCareerSection.swift @@ -4,6 +4,8 @@ struct TitledCareerSection: View { let style: CVStyle.Section + let accent: Color + let content: Titled var body: some View { @@ -12,7 +14,8 @@ struct TitledCareerSection: View { CareerStationView( info: item, borderSpacing: style.borderSpacing, - borderWidth: style.borderWidth) + borderWidth: style.borderWidth, + accent: accent) .padding(.bottom, style.bottomSpacing) } } @@ -23,6 +26,7 @@ struct TitledItemSection_Previews: PreviewProvider { static var previews: some View { TitledCareerSection( style: .init(), + accent: .orange, content: .init( title: "Work experience", items: [ diff --git a/ResumeBuilder/Main Elements/TopView.swift b/ResumeBuilder/Main Elements/TopView.swift index 85a6f36..67ece5b 100644 --- a/ResumeBuilder/Main Elements/TopView.swift +++ b/ResumeBuilder/Main Elements/TopView.swift @@ -7,6 +7,8 @@ struct TopView: View { let style: HeaderStyle + let accent: Color + var body: some View { GeometryReader { geo in let sideWidth = max(0, (geo.size.width - geo.size.height) / 2) @@ -14,7 +16,7 @@ struct TopView: View { VStack(alignment: .leading, spacing: 0) { Text(info.name) .font(.title) - .foregroundColor(.accentColor) + .foregroundColor(accent) Spacer(minLength: 0) Text(info.tagLine) .font(.subheadline) @@ -22,7 +24,6 @@ struct TopView: View { Spacer(minLength: 0) HStack { RightImageLabel(info.place, systemSymbol: .house) - .padding(.leading, -4) RightImageLabel(info.ageText, systemSymbol: .hourglass) Spacer() }.font(.subheadline) @@ -71,7 +72,8 @@ struct TopView_Previews: PreviewProvider { email: "jobs@christophhagen.de", phone: "Upon Request", github: "github.com/christophhagen"), - style: HeaderStyle()) + style: HeaderStyle(), + accent: .orange) .previewLayout(.fixed(width: 540, height: 120)) } } diff --git a/ResumeBuilder/Style/CVStyle.swift b/ResumeBuilder/Style/CVStyle.swift index 12ac064..f9ba09c 100644 --- a/ResumeBuilder/Style/CVStyle.swift +++ b/ResumeBuilder/Style/CVStyle.swift @@ -26,6 +26,8 @@ struct CVStyle { let pageWidth: CGFloat + let accentColor: Color + let header: HeaderStyle let columnSpacing: CGFloat