Skip to content

Commit 5e58567

Browse files
authored
feat: add borders for color squares in demo app color screen (#280) (#281)
Reviewed-by: Pierre-Yves Lapersonne <[email protected]>
1 parent 22e215e commit 5e58567

File tree

2 files changed

+5
-26
lines changed

2 files changed

+5
-26
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
### Added
1010

11+
- [DemoApp] Update color screen to add a border on color illustration square ([#280](https://github.com/Orange-OpenSource/ouds-ios/issues/280))
1112
- [DemoApp] Add grid tokens screen in demo app ([#151](https://github.com/Orange-OpenSource/ouds-ios/issues/151))
1213
- [Tool] GitHub Action to run SwiftLint for *main* and *develop* branches
1314

Showcase/Showcase/Pages/Tokens/Color/ColorTokenPage.swift

+4-26
Original file line numberDiff line numberDiff line change
@@ -127,33 +127,11 @@ struct ColorTokenPage: View {
127127
Rectangle()
128128
.fill(colorRawToken.color)
129129
.frame(width: 64, height: 64)
130-
.modifier(ExtraBorderModifier(color: colorRawToken))
130+
.oudsBorder(style: theme.borderStyleDefault,
131+
width: theme.borderWidthThin,
132+
radius: theme.borderRadiusNone,
133+
color: theme.colorBorderDefault)
131134
}
132135
}
133136
}
134137
}
135-
136-
// MARK: - Extra border modifier
137-
138-
// Add a border if color defined by token is equal to default background color of the root view
139-
private struct ExtraBorderModifier: ViewModifier {
140-
141-
@Environment(\.theme) private var theme
142-
@Environment(\.colorScheme) private var colorScheme
143-
144-
let color: ColorRawToken
145-
146-
func body(content: Content) -> some View {
147-
let defaultContentBackground = theme.colorBgPrimary.color(for: colorScheme)
148-
let addBorder = color.color == defaultContentBackground
149-
150-
if addBorder {
151-
content.oudsBorder(style: theme.borderStyleDefault,
152-
width: theme.borderWidthThin,
153-
radius: theme.borderRadiusNone,
154-
color: theme.colorContentDefault)
155-
} else {
156-
content
157-
}
158-
}
159-
}

0 commit comments

Comments
 (0)