Skip to content

Commit

Permalink
chore: update upgrade button and resume button style (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedbashir authored Jul 19, 2024
1 parent e585f7a commit c078524
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 33 deletions.
10 changes: 7 additions & 3 deletions Core/Core/View/Base/UnitButtonView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ public struct UnitButtonView: View {
case .continueLesson, .nextSection:
HStack {
Text(type.stringValue())
.foregroundColor(Theme.Colors.styledButtonText)
.foregroundColor(
type == .continueLesson ? Theme.Colors.accentColor :
Theme.Colors.styledButtonText)
.padding(.leading, 20)
.font(Theme.Fonts.labelLarge)
CoreAssets.arrowLeft.swiftUIImage.renderingMode(.template)
Expand Down Expand Up @@ -180,7 +182,9 @@ public struct UnitButtonView: View {

case .continueLesson, .nextSection, .reload, .finish, .custom:
Theme.Shapes.buttonShape
.fill(bgColor ?? Theme.Colors.accentButtonColor)
.fill(
type == .continueLesson ? Theme.Colors.background :
bgColor ?? Theme.Colors.accentButtonColor)

.shadow(color: (type == .first
|| type == .next
Expand All @@ -199,7 +203,7 @@ public struct UnitButtonView: View {
))
.foregroundColor(
type == .continueLesson
? Theme.Colors.accentButtonColor
? Theme.Colors.accentColor
: Theme.Colors.secondaryButtonBorderColor
)
)
Expand Down
62 changes: 34 additions & 28 deletions Course/Course/Presentation/Dates/DatesStatusInfoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct DatesStatusInfoView: View {
var body: some View {
VStack(alignment: .leading, spacing: 8) {
let header = datesBannerInfo.status?.header ?? ""
let button = datesBannerInfo.status?.buttonTitle ?? ""
let buttonTitle = datesBannerInfo.status?.buttonTitle ?? ""
Spacer()
if !header.isEmpty {
Text(header)
Expand All @@ -43,34 +43,40 @@ struct DatesStatusInfoView: View {
.foregroundColor(Theme.Colors.textPrimary)
.padding(.horizontal, 16)

if !button.isEmpty {
UnitButtonView(type: .custom(button)) {
guard !isLoading else { return }
isLoading = true
courseDatesViewModel?.trackPLSEvent(
.plsShiftDatesClicked,
bivalue: .plsShiftDatesClicked,
courseID: courseID,
screenName: screen.rawValue,
type: datesBannerInfo.status?.analyticsBannerType ?? ""
)
Task {
if courseDatesViewModel != nil {
await courseDatesViewModel?.shiftDueDates(
courseID: courseID,
screen: screen,
type: datesBannerInfo.status?.analyticsBannerType ?? ""
)
} else if courseContainerViewModel != nil {
await courseContainerViewModel?.shiftDueDates(
courseID: courseID,
screen: screen,
type: datesBannerInfo.status?.analyticsBannerType ?? ""
)
if !buttonTitle.isEmpty {
StyledButton(
buttonTitle,
action: {
guard !isLoading else { return }
isLoading = true
courseDatesViewModel?.trackPLSEvent(
.plsShiftDatesClicked,
bivalue: .plsShiftDatesClicked,
courseID: courseID,
screenName: screen.rawValue,
type: datesBannerInfo.status?.analyticsBannerType ?? ""
)
Task {
if courseDatesViewModel != nil {
await courseDatesViewModel?.shiftDueDates(
courseID: courseID,
screen: screen,
type: datesBannerInfo.status?.analyticsBannerType ?? ""
)
} else if courseContainerViewModel != nil {
await courseContainerViewModel?.shiftDueDates(
courseID: courseID,
screen: screen,
type: datesBannerInfo.status?.analyticsBannerType ?? ""
)
}
isLoading = false
}
isLoading = false
}
}

},
color: Theme.Colors.accentColor,
textColor: Theme.Colors.primaryButtonTextColor
)
.padding([.leading, .trailing], 16)
.disabled(isLoading)
}
Expand Down
4 changes: 2 additions & 2 deletions Course/Course/Presentation/Subviews/CourseHeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ struct CourseHeaderView: View {
action: {
upgradeAction?()
},
color: Theme.Colors.accentColor,
textColor: Theme.Colors.primaryButtonTextColor,
color: Theme.Colors.accentButtonColor,
textColor: Theme.Colors.styledButtonText,
leftImage: Image(systemName: "lock.fill"),
imagesStyle: .attachedToText,
isTitleTracking: false,
Expand Down

0 comments on commit c078524

Please sign in to comment.