forked from openedx/openedx-app-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [FC-0047] move the certificate view from the banner to the mess…
…age section (openedx#387) * feat: move the certificate view from the banner to the message section * refactor: Rename badge to certificateBadge and improve code structure - Rename `badge` to `certificateBadge` on Assets to enhance semantic clarity. - Refactor conditional unwrapping of `certificate.url` in viewModel for improved code readability. Add SFPro-Light font to whitelabel configuration * fix: update Theming_implementation add light font
- Loading branch information
1 parent
76f0430
commit 16b17b6
Showing
14 changed files
with
143 additions
and
52 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
Core/Core/Assets.xcassets/certificateBadge.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "certificateIcon.svg", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"template-rendering-intent" : "template" | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
Core/Core/Assets.xcassets/certificateBadge.imageset/certificateIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
Course/Course/Presentation/Subviews/MessageSectionView/MessageSectionView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// | ||
// MessageSectionView.swift | ||
// Course | ||
// | ||
// Created by Stepanok Ivan on 03.04.2024. | ||
// | ||
|
||
import SwiftUI | ||
import Core | ||
import Theme | ||
|
||
public struct MessageSectionView: View { | ||
|
||
private let title: String | ||
private let actionTitle: String | ||
private var action: (() -> Void) = {} | ||
|
||
public init( | ||
title: String, | ||
actionTitle: String, | ||
action: @escaping () -> Void | ||
) { | ||
self.title = title | ||
self.actionTitle = actionTitle | ||
self.action = action | ||
} | ||
|
||
public var body: some View { | ||
HStack(alignment: .top, spacing: 8) { | ||
CoreAssets.certificateBadge.swiftUIImage | ||
.resizable() | ||
.frame(width: 24, height: 24) | ||
.foregroundColor(Theme.Colors.textPrimary) | ||
VStack(alignment: .leading, spacing: 8) { | ||
Text(title) | ||
.font(Theme.Fonts.bodyMicro) | ||
.foregroundColor(Theme.Colors.textPrimary) | ||
|
||
Button(action: { | ||
action() | ||
}, label: { | ||
Text(actionTitle) | ||
.font(Theme.Fonts.bodyMicro) | ||
.underline() | ||
.foregroundColor(Theme.Colors.textPrimary) | ||
}) | ||
} | ||
} | ||
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading) | ||
.padding(.all, 12) | ||
.background(RoundedRectangle(cornerRadius: 8) | ||
.stroke(lineWidth: 1) | ||
.fill(Theme.Colors.textInputStroke) | ||
) | ||
} | ||
} | ||
|
||
#Preview { | ||
MessageSectionView( | ||
title: "Congratulations, you have earned this course certificate in “Course Title.”", | ||
actionTitle: "View Certificate", | ||
action: { | ||
} | ||
) | ||
.loadFonts() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"light": "SFPro-Light", | ||
"regular": "SFPro-Regular", | ||
"medium": "SFPro-Medium", | ||
"semiBold": "SFPro-Semibold", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters