Skip to content

Commit

Permalink
chore: configureable resume button (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedbashir authored and rnr committed Dec 17, 2024
1 parent 7cc91f2 commit 3b27160
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Core/Core/View/Base/UnitButtonView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,16 @@ public struct UnitButtonView: View {
case .continueLesson, .nextSection:
HStack {
Text(type.stringValue())
.foregroundColor(Theme.Colors.styledButtonText)
.foregroundColor(
type == .continueLesson ? Theme.Colors.resumeButtonText :
Theme.Colors.styledButtonText
)
.padding(.leading, 20)
.font(Theme.Fonts.labelLarge)
CoreAssets.arrowLeft.swiftUIImage.renderingMode(.template)
.foregroundColor(
type == .continueLesson
? Theme.Colors.accentColor
? Theme.Colors.resumeButtonText
: Theme.Colors.styledButtonText
)
.rotationEffect(Angle.degrees(180))
Expand Down Expand Up @@ -184,7 +187,10 @@ public struct UnitButtonView: View {

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

.shadow(color: (type == .first
|| type == .next
Expand Down
6 changes: 6 additions & 0 deletions Theme/Theme/Assets.xcassets/Colors/ResumeButton/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "0.408",
"red" : "0.235"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xF8",
"green" : "0x78",
"red" : "0x53"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
2 changes: 2 additions & 0 deletions Theme/Theme/SwiftGen/ThemeAssets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public enum ThemeAssets {
public static let progressDone = ColorAsset(name: "ProgressDone")
public static let progressSkip = ColorAsset(name: "ProgressSkip")
public static let selectedAndDone = ColorAsset(name: "SelectedAndDone")
public static let resumeButtonBG = ColorAsset(name: "ResumeButtonBG")
public static let resumeButtonText = ColorAsset(name: "ResumeButtonText")
public static let secondaryButtonBGColor = ColorAsset(name: "SecondaryButtonBGColor")
public static let secondaryButtonBorderColor = ColorAsset(name: "SecondaryButtonBorderColor")
public static let secondaryButtonTextColor = ColorAsset(name: "SecondaryButtonTextColor")
Expand Down
2 changes: 2 additions & 0 deletions Theme/Theme/Theme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public struct Theme: Sendable {
nonisolated(unsafe) public private(set) static var primaryCardUpgradeBG = ThemeAssets.primaryCardCourseUpgradeBG.swiftUIColor
nonisolated(unsafe) public private(set) static var primaryCardProgressBG = ThemeAssets.primaryCardProgressBG.swiftUIColor
nonisolated(unsafe) public private(set) static var courseProgressBG = ThemeAssets.courseProgressBG.swiftUIColor
nonisolated(unsafe) public private(set) static var resumeButtonBG = ThemeAssets.resumeButtonBG.swiftUIColor
nonisolated(unsafe) public private(set) static var resumeButtonText = ThemeAssets.resumeButtonText.swiftUIColor

public static func update(
accentColor: Color = ThemeAssets.accentColor.swiftUIColor,
Expand Down

0 comments on commit 3b27160

Please sign in to comment.