Specify accent color in style
This commit is contained in:
parent
cd37df22bf
commit
c9ab73c4ae
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -3,6 +3,7 @@ import SwiftUI
|
||||
|
||||
let cvStyle = CVStyle(
|
||||
pageWidth: 600,
|
||||
accentColor: .init(244, 144, 0),
|
||||
header: HeaderStyle(
|
||||
height: 100,
|
||||
lineWidth: 1,
|
||||
|
@ -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(
|
||||
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)
|
||||
borderWidth: 3,
|
||||
accent: .orange)
|
||||
.previewLayout(.fixed(width: 300, height: 100))
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,8 @@ struct TitledCareerSection: View {
|
||||
|
||||
let style: CVStyle.Section
|
||||
|
||||
let accent: Color
|
||||
|
||||
let content: Titled<CareerStation>
|
||||
|
||||
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: [
|
||||
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,8 @@ struct CVStyle {
|
||||
|
||||
let pageWidth: CGFloat
|
||||
|
||||
let accentColor: Color
|
||||
|
||||
let header: HeaderStyle
|
||||
|
||||
let columnSpacing: CGFloat
|
||||
|
Loading…
Reference in New Issue
Block a user