Skip to content

Commit

Permalink
chore: theme enhancements (#476)
Browse files Browse the repository at this point in the history
* chore: theme enhancement

* chore: theme enhancements

* chore: theme improvements

* chore: address design team feedback

* chore: adding new color for coursecardbackground

* fix: using correct colors for openedX

* fix: using irreversibleAlert in registration to highlight errors

* fix: comment added pop-up message text is not visible in dark mode

* refactor: fix typo
  • Loading branch information
saeedbashir authored Jul 9, 2024
1 parent bd270b7 commit 5f4268c
Show file tree
Hide file tree
Showing 26 changed files with 143 additions and 60 deletions.
19 changes: 6 additions & 13 deletions Core/Core/View/Base/AlertView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,8 @@ public struct AlertView: View {
.fixedSize(horizontal: false, vertical: false)
)
.overlay(
RoundedRectangle(cornerRadius: 12)
.stroke(
style: .init(
lineWidth: 1,
lineCap: .round,
lineJoin: .round,
miterLimit: 1
)
)
Theme.Shapes.buttonShape
.stroke(lineWidth: 1)
.foregroundColor(Theme.Colors.backgroundStroke)
.fixedSize(horizontal: false, vertical: false)
)
Expand Down Expand Up @@ -256,7 +249,7 @@ public struct AlertView: View {
.frame(maxWidth: 215)
}
UnitButtonView(type: .custom(action),
bgColor: .clear,
bgColor: Theme.Colors.secondaryButtonBGColor,
action: { okTapped() })
.frame(maxWidth: 215)

Expand Down Expand Up @@ -417,7 +410,7 @@ public struct AlertView: View {
} label: {
ZStack {
Text(primaryButtonTitle)
.foregroundColor(Theme.Colors.primaryButtonTextColor)
.foregroundColor(Theme.Colors.styledButtonText)
.font(Theme.Fonts.labelLarge)
.frame(maxWidth: .infinity)
.padding(.horizontal, 16)
Expand All @@ -426,7 +419,7 @@ public struct AlertView: View {
}
.background(
Theme.Shapes.buttonShape
.fill(Theme.Colors.accentColor)
.fill(Theme.Colors.accentButtonColor)
)
.overlay(
RoundedRectangle(cornerRadius: 8)
Expand Down Expand Up @@ -454,7 +447,7 @@ public struct AlertView: View {
})
.background(
Theme.Shapes.buttonShape
.fill(.clear)
.fill(Theme.Colors.secondaryButtonBGColor)
)
.overlay(
RoundedRectangle(cornerRadius: 8)
Expand Down
2 changes: 1 addition & 1 deletion Core/Core/View/Base/CourseCellView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public struct CourseCellView: View {
.overlay(Theme.Colors.cardViewStroke)
.padding(.vertical, 18)
.padding(.horizontal, 3)
.accessibilityIdentifier("devider")
.accessibilityIdentifier("divider")
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Core/Core/View/Base/LogistrationBottomView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public struct LogistrationBottomView: View {
action: {
action(.signIn)
},
color: Theme.Colors.background,
color: Theme.Colors.secondaryButtonBGColor,
textColor: Theme.Colors.secondaryButtonTextColor,
borderColor: Theme.Colors.secondaryButtonBorderColor
)
Expand Down
4 changes: 2 additions & 2 deletions Core/Core/View/Base/PickerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ public struct PickerView: View {
.stroke(lineWidth: 1)
.fill(config.error == "" ?
Theme.Colors.textInputStroke
: Theme.Colors.alert)
: Theme.Colors.irreversibleAlert)
)
.shake($config.shake)
Text(config.error == "" ? config.field.instructions
: config.error)
.font(Theme.Fonts.labelMedium)
.foregroundColor(config.error == ""
? Theme.Colors.textPrimary
: Theme.Colors.alert)
: Theme.Colors.irreversibleAlert)
.accessibilityIdentifier("\(config.field.name)_instructions_text")
}
}
Expand Down
8 changes: 4 additions & 4 deletions Core/Core/View/Base/RegistrationTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public struct RegistrationTextField: View {
.fill(
config.error == "" ?
Theme.Colors.textInputStroke
: Theme.Colors.alert
: Theme.Colors.irreversibleAlert
)
)
.shake($config.shake)
Expand All @@ -83,7 +83,7 @@ public struct RegistrationTextField: View {
.fill(
config.error == "" ?
Theme.Colors.textInputStroke
: Theme.Colors.alert
: Theme.Colors.irreversibleAlert
)
)
.shake($config.shake)
Expand All @@ -107,7 +107,7 @@ public struct RegistrationTextField: View {
.fill(
config.error == "" ?
Theme.Colors.textInputStroke
: Theme.Colors.alert
: Theme.Colors.irreversibleAlert
)
)
.shake($config.shake)
Expand All @@ -119,7 +119,7 @@ public struct RegistrationTextField: View {
.font(Theme.Fonts.bodySmall)
.foregroundColor(config.error == ""
? Theme.Colors.textSecondaryLight
: Theme.Colors.alert)
: Theme.Colors.irreversibleAlert)
.accessibilityIdentifier("\(config.field.name)_instructions_text")
}
}
Expand Down
29 changes: 14 additions & 15 deletions Core/Core/View/Base/UnitButtonView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,66 +75,66 @@ public struct UnitButtonView: View {
case .first:
HStack {
Text(type.stringValue())
.foregroundColor(Theme.Colors.styledButtonText)
.foregroundColor(Theme.Colors.primaryButtonTextColor)
.font(Theme.Fonts.labelLarge)
CoreAssets.arrowLeft.swiftUIImage.renderingMode(.template)
.foregroundColor(Theme.Colors.styledButtonText)
.foregroundColor(Theme.Colors.primaryButtonTextColor)
.rotationEffect(Angle.degrees(nextButtonDegrees))
}.padding(.horizontal, 16)
case .next, .nextBig:
HStack {
Text(type.stringValue())
.foregroundColor(Theme.Colors.styledButtonText)
.foregroundColor(Theme.Colors.primaryButtonTextColor)
.padding(.leading, 20)
.font(Theme.Fonts.labelLarge)
if type != .nextBig {
Spacer()
}
CoreAssets.arrowLeft.swiftUIImage.renderingMode(.template)
.foregroundColor(Theme.Colors.styledButtonText)
.foregroundColor(Theme.Colors.primaryButtonTextColor)
.rotationEffect(Angle.degrees(nextButtonDegrees))
.padding(.trailing, 20)
}
case .previous:
HStack {
if isVerticalNavigation {
Text(type.stringValue())
.foregroundColor(Theme.Colors.secondaryButtonTextColor)
.foregroundColor(Theme.Colors.accentColor)
.font(Theme.Fonts.labelLarge)
.padding(.leading, 20)
CoreAssets.arrowLeft.swiftUIImage.renderingMode(.template)
.rotationEffect(Angle.degrees(90))
.padding(.trailing, 20)
.foregroundColor(Theme.Colors.secondaryButtonTextColor)
.foregroundColor(Theme.Colors.accentColor)
} else {
CoreAssets.arrowLeft.swiftUIImage.renderingMode(.template)
.padding(.leading, 20)
.foregroundColor(Theme.Colors.secondaryButtonTextColor)
.foregroundColor(Theme.Colors.accentColor)
Text(type.stringValue())
.foregroundColor(Theme.Colors.secondaryButtonTextColor)
.foregroundColor(Theme.Colors.accentColor)
.font(Theme.Fonts.labelLarge)
.padding(.trailing, 20)
}
}
case .last:
HStack {
Text(type.stringValue())
.foregroundColor(Theme.Colors.styledButtonText)
.foregroundColor(Theme.Colors.primaryButtonTextColor)
.padding(.leading, 8)
.font(Theme.Fonts.labelLarge)
.scaledToFit()
Spacer()
CoreAssets.check.swiftUIImage.renderingMode(.template)
.foregroundColor(Theme.Colors.styledButtonText)
.foregroundColor(Theme.Colors.primaryButtonTextColor)
.padding(.trailing, 8)
}
case .finish:
HStack {
Text(type.stringValue())
.foregroundColor(Theme.Colors.styledButtonText)
.foregroundColor(Theme.Colors.primaryButtonTextColor)
.font(Theme.Fonts.labelLarge)
CoreAssets.check.swiftUIImage.renderingMode(.template)
.foregroundColor(Theme.Colors.styledButtonText)
.foregroundColor(Theme.Colors.primaryButtonTextColor)
}.padding(.horizontal, 16)
case .reload, .custom:
VStack(alignment: .center) {
Expand Down Expand Up @@ -163,7 +163,7 @@ public struct UnitButtonView: View {
Theme.Shapes.buttonShape
.fill(type == .previous
? Theme.Colors.background
: Theme.Colors.accentButtonColor)
: Theme.Colors.accentColor)
.shadow(color: Color.black.opacity(0.25), radius: 21, y: 4)
.overlay(
Theme.Shapes.buttonShape
Expand All @@ -174,8 +174,7 @@ public struct UnitButtonView: View {
miterLimit: 1)
)
.foregroundColor(
type == .previous ? Theme.Colors.secondaryButtonBorderColor
: Theme.Colors.accentButtonColor
Theme.Colors.accentColor
)
)

Expand Down
3 changes: 3 additions & 0 deletions Course/Course/Presentation/Handouts/HandoutsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ struct HandoutsView: View {
)
})
Divider()
.frame(height: 1)
.overlay(Theme.Colors.cardViewStroke)
.accessibilityIdentifier("divider")
HandoutsItemCell(type: .announcements, onTapAction: {
if !viewModel.updates.isEmpty {
viewModel.router.showHandoutsUpdatesView(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ struct CustomDisclosureGroup: View {
.padding(.vertical, 12)
.background(
RoundedRectangle(cornerRadius: 8)
.fill(Theme.Colors.tabbarColor)
.fill(Theme.Colors.datesSectionBackground)
)
.overlay(
RoundedRectangle(cornerRadius: 8)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ struct CourseCardView: View {
.padding(8)
}
}
.background(Theme.Colors.background)
.background(Theme.Colors.courseCardBackground)
.cornerRadius(8)
.shadow(color: Theme.Colors.courseCardShadow, radius: 6, x: 2, y: 2)
}
Expand Down
3 changes: 2 additions & 1 deletion Dashboard/Dashboard/Presentation/Elements/DropDownMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ struct DropDownMenu: View {
Text(option.text)
.font(Theme.Fonts.titleSmall)
.foregroundColor(
option == selectedOption ? Theme.Colors.white : Theme.Colors.textPrimary
option == selectedOption ? Theme.Colors.primaryButtonTextColor :
Theme.Colors.textPrimary
)
Spacer()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public struct PrimaryCardView: View {
assignments
}
}
.background(Theme.Colors.background)
.background(Theme.Colors.courseCardBackground)
.cornerRadius(8)
.shadow(color: Theme.Colors.courseCardShadow, radius: 4, x: 0, y: 3)
.padding(20)
Expand Down Expand Up @@ -206,12 +206,12 @@ public struct PrimaryCardView: View {
}
.padding(.top, 8)
.padding(.bottom, selected ? 10 : 0)
}.background(selected ? Theme.Colors.accentColor : .clear)
}.background(selected ? Theme.Colors.accentButtonColor : .clear)
})
}

private func foregroundColor(_ selected: Bool) -> SwiftUI.Color {
return selected ? Theme.Colors.primaryButtonTextColor : Theme.Colors.textPrimary
return selected ? Theme.Colors.white : Theme.Colors.textPrimary
}

private var courseBanner: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct ProgressLineView: View {
Rectangle()
.foregroundStyle(Theme.Colors.cardViewStroke)
Rectangle()
.foregroundStyle(Theme.Colors.accentColor)
.foregroundStyle(Theme.Colors.accentButtonColor)
.frame(width: geometry.size.width * progressValue)
}.frame(height: height)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ public struct CommentCell: View {
onLikeTap()
}, label: {
comment.voted
? CoreAssets.voted.swiftUIImage
: CoreAssets.vote.swiftUIImage
? (CoreAssets.voted.swiftUIImage.renderingMode(.template))
: CoreAssets.vote.swiftUIImage.renderingMode(.template)
Text("\(comment.votesCount)")
Text(DiscussionLocalization.votesCount(comment.votesCount))
.font(Theme.Fonts.labelLarge)
}).foregroundColor(comment.voted
? Theme.Colors.accentColor
? Theme.Colors.accentXColor
: Theme.Colors.textSecondary)

Spacer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ public struct ParentCommentView: View {
onLikeTap()
}, label: {
comments.voted
? CoreAssets.voted.swiftUIImage
: CoreAssets.vote.swiftUIImage
? (CoreAssets.voted.swiftUIImage.renderingMode(.template))
: (CoreAssets.vote.swiftUIImage.renderingMode(.template))
Text("\(comments.votesCount)")
.foregroundColor(Theme.Colors.textPrimary)
Text(DiscussionLocalization.votesCount(comments.votesCount))
.font(Theme.Fonts.labelLarge)
.foregroundColor(Theme.Colors.textPrimary)
}).foregroundColor(comments.voted
? Theme.Colors.accentColor
? Theme.Colors.accentXColor
: Theme.Colors.textSecondaryLight)
Spacer()
Button(action: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public struct ThreadView: View {
Text(viewModel.alertMessage ?? "")
.shadowCardStyle(
bgColor: Theme.Colors.accentColor,
textColor: Theme.Colors.white
textColor: Theme.Colors.primaryButtonTextColor
)
.padding(.top, 80)
Spacer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,14 @@ struct NewCalendarView: View {
)

VStack(spacing: 16) {
StyledButton(ProfileLocalization.Calendar.cancel,
action: {
onCloseTapped()
},
color: Theme.Colors.background,
textColor: Theme.Colors.accentColor,
borderColor: Theme.Colors.accentColor
StyledButton(
ProfileLocalization.Calendar.cancel,
action: {
onCloseTapped()
},
color: Theme.Colors.background,
textColor: Theme.Colors.accentColor,
borderColor: Theme.Colors.accentColor
)

StyledButton(ProfileLocalization.Calendar.beginSyncing) {
Expand Down
2 changes: 1 addition & 1 deletion Profile/Profile/Presentation/Profile/ProfileView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public struct ProfileView: View {
}
)
},
color: .clear,
color: Theme.Colors.background,
textColor: Theme.Colors.accentColor,
borderColor: Theme.Colors.accentColor
).padding(.all, 24)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public struct ManageAccountView: View {
}
)
},
color: .clear,
color: Theme.Colors.background,
textColor: Theme.Colors.accentColor,
borderColor: Theme.Colors.accentColor
).padding(.horizontal, 24)
Expand Down
Loading

0 comments on commit 5f4268c

Please sign in to comment.