Skip to content

Commit 201c6be

Browse files
authored
refactor: colors of texts and bullets for alert message component (#1342) (#1348)
Change colors for label, description and bullet list (items and bullets) for alert message component Closes #1342 Tested-by: Anton Astafev <anton.astafev@orange.com> Reviewed-by: Copilot <198982749+Copilot@users.noreply.github.com> Reviewed-by: Ludovic Pinel <ludovic.pinel@orange.com> Signed-off-by: Pierre-Yves Lapersonne <pierreyves.lapersonne@orange.com>
1 parent 78e9f70 commit 201c6be

File tree

6 files changed

+50
-10
lines changed

6 files changed

+50
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717

1818
### Changed
1919

20+
- `alert message` component with new label colors (Orange-OpenSource/ouds-ios#1342)
2021
- Rename in `bullet list` component API "unordered icon" to "unordered asset" (Orange-OpenSource/ouds-ios#1326)
2122
- AGENTS.md file to focus only on users (Orange-OpenSource/ouds-ios#1341)
2223
- Signatures of control-item-based components (Orange-OpenSource/ouds-ios#1314)

OUDS/Core/Components/Sources/Dialogs/Alert/Internal/AlertMessage/AlertMessageBulletList.swift

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ struct AlertMessageBulletListItem: View {
1919
// MARK: - Properties
2020

2121
let text: String
22+
let status: OUDSAlertStatus
2223

2324
@Environment(\.theme) private var theme
2425
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
@@ -30,19 +31,21 @@ struct AlertMessageBulletListItem: View {
3031
var body: some View {
3132
HStack(alignment: .top, spacing: theme.bulletList.spaceColumnGapBodyMedium) {
3233
HStack(alignment: .center) {
33-
OUDSIcon(assetName: "ic_bullet_list_level0", color: theme.colors.contentMuted)
34+
OUDSIcon(assetName: "ic_bullet_list_level0", color: foregroundColor)
3435
.frame(width: iconSize, height: iconSize)
3536
}
3637
.frame(width: width, alignment: .trailing)
3738
.frame(maxHeight: maxHeight, alignment: .center)
3839

3940
Text(text)
4041
.labelDefaultMedium(theme)
41-
.oudsForegroundColor(theme.colors.contentMuted)
42+
.oudsForegroundColor(foregroundColor)
4243
.frame(maxWidth: theme.sizes.maxWidthTypeLabelMedium.dimension(for: horizontalSizeClass ?? .regular), alignment: .leading)
4344
}
4445
}
4546

47+
// MARK: - Helpers
48+
4649
private var iconSize: CGFloat {
4750
let rawSize = theme.sizes.iconWithLabelMediumSizeSmall
4851
return rawSize * dynamicTypeSize.percentageRate / 100
@@ -57,4 +60,21 @@ struct AlertMessageBulletListItem: View {
5760
let rawSize = theme.fonts.lineHeightBodyMedium.lineHeight(for: verticalSizeClass ?? .regular)
5861
return rawSize * dynamicTypeSize.percentageRate / 100
5962
}
63+
64+
private var foregroundColor: MultipleColorSemanticToken {
65+
switch status {
66+
case .neutral:
67+
theme.colors.contentDefault
68+
case .accent:
69+
theme.colors.contentOnStatusAccentMuted
70+
case .positive:
71+
theme.colors.contentOnStatusPositiveMuted
72+
case .negative:
73+
theme.colors.contentOnStatusNegativeMuted
74+
case .warning:
75+
theme.colors.contentOnStatusWarningMuted
76+
case .info:
77+
theme.colors.contentOnStatusInfoMuted
78+
}
79+
}
6080
}

OUDS/Core/Components/Sources/Dialogs/Alert/Internal/AlertMessage/AlertMessageContent.swift

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ struct AlertMessageContent: View {
1919
// MARK: - Properties
2020

2121
let text: String
22+
let status: OUDSAlertStatus
2223
let description: String?
2324
let bulletList: [String]
2425
let link: OUDSAlertMessage.Link?
@@ -32,20 +33,20 @@ struct AlertMessageContent: View {
3233
VStack(alignment: .leading, spacing: theme.alert.spaceRowGap) {
3334
Text(text)
3435
.labelModerateLarge(theme)
35-
.oudsForegroundColor(theme.colors.contentDefault)
36+
.oudsForegroundColor(foregroundColor)
3637
.frame(maxWidth: .infinity, alignment: .leading)
3738

3839
if let description, !description.isEmpty {
3940
Text(description)
4041
.labelDefaultMedium(theme)
41-
.oudsForegroundColor(theme.colors.contentMuted)
42+
.oudsForegroundColor(foregroundColor)
4243
.frame(maxWidth: .infinity, alignment: .leading)
4344
}
4445

4546
if !bulletList.isEmpty {
4647
VStack(alignment: .leading, spacing: theme.alert.spaceRowGapBullet) {
4748
ForEach(Array(bulletList.enumerated()), id: \.offset) { _, text in
48-
AlertMessageBulletListItem(text: text)
49+
AlertMessageBulletListItem(text: text, status: status)
4950
}
5051
}
5152
}
@@ -59,4 +60,23 @@ struct AlertMessageContent: View {
5960
.padding(.vertical, theme.alert.spacePaddingBlock)
6061
.fixedSize(horizontal: false, vertical: true)
6162
}
63+
64+
// MARK: - Helpers
65+
66+
private var foregroundColor: MultipleColorSemanticToken {
67+
switch status {
68+
case .neutral:
69+
theme.colors.contentDefault
70+
case .accent:
71+
theme.colors.contentOnStatusAccentMuted
72+
case .positive:
73+
theme.colors.contentOnStatusPositiveMuted
74+
case .negative:
75+
theme.colors.contentOnStatusNegativeMuted
76+
case .warning:
77+
theme.colors.contentOnStatusWarningMuted
78+
case .info:
79+
theme.colors.contentOnStatusInfoMuted
80+
}
81+
}
6282
}

OUDS/Core/Components/Sources/Dialogs/Alert/OUDSAlertMessage.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ import SwiftUI
6565
///
6666
/// ![An alert message component in light and dark modes with Wireframe theme](component_alertMessage_Wireframe)
6767
///
68-
/// - Version: 1.0.0 (Figma component design version)
68+
/// - Version: 1.1.0 (Figma component design version)
6969
/// - Since: 1.3.0
7070
@available(iOS 15, macOS 13, visionOS 1, tvOS 16, *)
7171
public struct OUDSAlertMessage: View {
@@ -162,7 +162,7 @@ public struct OUDSAlertMessage: View {
162162
HStack(alignment: .top, spacing: theme.alert.spaceColumnGap) {
163163
AlertLeadingIcon(status: status)
164164
.padding(.top, theme.alert.spacePaddingBlock)
165-
AlertMessageContent(text: text, description: description, bulletList: bulletList, link: link)
165+
AlertMessageContent(text: text, status: status, description: description, bulletList: bulletList, link: link)
166166
AlertMessageAction(link: link, onClose: onClose)
167167
}
168168
.padding(.leading, theme.alert.spacePaddingInline)

OUDS/Core/Components/Sources/_/Extensions/View+Grids.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// Software description: A SwiftUI components library with code examples for Orange Unified Design System
1212
//
1313

14-
import OUDSThemesContract
1514
import SwiftUI
1615

1716
extension View {

OUDS/Core/ThemesContract/Sources/TokenatorConstants.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ public enum OUDSVersions {
7676

7777
// MARK: - Components versions - Dialog
7878

79-
/// Version of the Figma specifications for the component alert (alert message) (1.0.0)
80-
public static let componentAlertMessageVersion = "1.0.0"
79+
/// Version of the Figma specifications for the component alert (alert message) (1.1.0)
80+
public static let componentAlertMessageVersion = "1.1.0" // WARNING: Manually updated as tokenator not updated yet
8181
/// Version of the Figma specifications for the component alert (inline alert) (1.0.0)
8282
public static let componentInlineAlertVersion = "1.0.0"
8383

0 commit comments

Comments
 (0)