Specify accent color in style

This commit is contained in:
Christoph Hagen
2023-08-23 16:17:34 +02:00
parent cd37df22bf
commit c9ab73c4ae
10 changed files with 48 additions and 25 deletions

View File

@@ -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))
}
}

View File

@@ -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)
}
}