Skip to content

Commit

Permalink
refactor: update code sample text view in demo app (#361) (#362)
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre-Yves Lapersonne <[email protected]>
  • Loading branch information
ludovic35 authored Dec 20, 2024
1 parent 0cdcbf2 commit 327475d
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 21 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased](https://github.com/Orange-OpenSource/ouds-ios/compare/0.8.0...develop)

### Changed

- [DemoApp] Update show code text ([#361](https://github.com/Orange-OpenSource/ouds-ios/issues/361))

## [0.8.0](https://github.com/Orange-OpenSource/ouds-ios/compare/0.7.0...0.8.0) - 2024-12-18

### Added
Expand Down
8 changes: 4 additions & 4 deletions Showcase/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
PODS:
- SwiftFormat/CLI (0.55.3)
- SwiftLint (0.57.0)
- SwiftLint (0.57.1)

DEPENDENCIES:
- SwiftFormat/CLI (= 0.55.3)
- SwiftLint (= 0.57.0)
- SwiftLint (= 0.57.1)

SPEC REPOS:
trunk:
Expand All @@ -13,8 +13,8 @@ SPEC REPOS:

SPEC CHECKSUMS:
SwiftFormat: 2f3558ca02842dcd3fd970360d2d4054bd21624a
SwiftLint: eb47480d47c982481592c195c221d11013a679cc
SwiftLint: 92196976e597b9afec5dbe374810103e6c1d9d7c

PODFILE CHECKSUM: 48af44a98a1ebfa588f530c218eac9369a4515bf
PODFILE CHECKSUM: c4ad93a479bf732e918b4e92f458ff72333a85fc

COCOAPODS: 1.16.2
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ struct ComponentConfigurationView<Component, Configuration>: View where Componen
}
.padding(.horizontal, theme.spaces.spaceFixedMedium)

ShowcaseCode(code: configuration.code)
ShowcaseCode(code: configuration.code, titleText: "app_components_common_viewCodeExample_label")
.padding(.horizontal, theme.spaces.spaceFixedMedium)
}
.padding(.bottom, theme.spaces.spaceFixedMedium)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct BorderTokenPage: View {
VStack(alignment: .leading, spacing: theme.spaces.spaceFixedMedium) {
Section {
VStack(alignment: .leading, spacing: theme.spaces.spaceFixedNone) {
ShowcaseCode(code: "theme.borders.borderWidthDefault")
ShowcaseCode(code: "theme.borders.borderWidthDefault", titleText: "app_tokens_common_viewCodeExample_label")
}
}
Section {
Expand Down
2 changes: 1 addition & 1 deletion Showcase/Showcase/Pages/Tokens/Color/ColorTokenPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct ColorTokenPage: View {
var body: some View {
Group {
Section {
ShowcaseCode(code: "theme.colors.colorBgPrimary.color(for: colorScheme)")
ShowcaseCode(code: "theme.colors.colorBgPrimary.color(for: colorScheme)", titleText: "app_tokens_common_viewCodeExample_label")
}
Section { illustrationForAction() } header: { header("Action") }
Section { illustrationForAlways() } header: { header("Always") }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct SizeTokenPage: View {
var body: some View {
Group {
Section {
ShowcaseCode(code: "theme.sizeIconWithHeadingXLargeShort.dimension(for: horizontalSizeClass ?? .regular)")
ShowcaseCode(code: "theme.sizeIconWithHeadingXLargeShort.dimension(for: horizontalSizeClass ?? .regular)", titleText: "app_tokens_common_viewCodeExample_label")
}
Section {
ForEach(NamedSize.IconDecorative.allCases, id: \.rawValue) { namedSize in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct SpaceTokenPage: View {
var body: some View {
Group {
Section {
ShowcaseCode(code: "theme.spaceScaledMedium.dimension(for: horizontalSizeClass ?? .regular)")
ShowcaseCode(code: "theme.spaceScaledMedium.dimension(for: horizontalSizeClass ?? .regular)", titleText: "app_tokens_common_viewCodeExample_label")
}
// Basic Space Tokens
Section { ScaledSpaceProperty() } header: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct ElevationTokenPage: View {
var body: some View {
VStack(alignment: .leading, spacing: theme.spaces.spaceFixedNone) {
Section {
ShowcaseCode(code: "theme.elevations.elevationNone.elevation(for: colorScheme)")
ShowcaseCode(code: "theme.elevations.elevationNone.elevation(for: colorScheme)", titleText: "app_tokens_common_viewCodeExample_label")
}

Spacer().frame(height: theme.spaces.spaceFixedMedium)
Expand Down
2 changes: 1 addition & 1 deletion Showcase/Showcase/Pages/Tokens/Font/FontTokenPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct FontTokenPage: View {
var body: some View {
VStack(alignment: .leading, spacing: theme.spaces.spaceFixedNone) {
Section {
ShowcaseCode(code: "theme.typeBodyStrongLarge(theme)")
ShowcaseCode(code: "theme.typeBodyStrongLarge(theme)", titleText: "app_tokens_common_viewCodeExample_label")
}

Spacer()
Expand Down
2 changes: 1 addition & 1 deletion Showcase/Showcase/Pages/Tokens/Grid/GrisTokenPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct GridTokenPage: View {
}

Section {
ShowcaseCode(code: "theme.gridColumnCount(for: horizontalSizeClass)")
ShowcaseCode(code: "theme.gridColumnCount(for: horizontalSizeClass)", titleText: "app_tokens_common_viewCodeExample_label")
}

Section { illustrationForGridTokens() } header: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct OpacityTokenPage: View {
var body: some View {
VStack(alignment: .leading, spacing: theme.spaces.spaceFixedNone) {
Section {
ShowcaseCode(code: "theme.opacities.opacityInvisible")
ShowcaseCode(code: "theme.opacities.opacityInvisible", titleText: "app_tokens_common_viewCodeExample_label")
}

Spacer() .frame(height: theme.spaces.spaceFixedMedium)
Expand Down
9 changes: 5 additions & 4 deletions Showcase/Showcase/Pages/Utils/ShowcaseCode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ struct ShowcaseCode: View {

@State private var isCodeVisible = false
let code: String
let titleText: LocalizedStringKey

// MARK: Body

Expand All @@ -44,7 +45,7 @@ struct ShowcaseCode: View {
VStack(alignment: .leading, spacing: theme.spaces.spaceFixedNone) {
Button(action: toggle) {
HStack {
Text("app_tokens_code_title_label")
Text(titleText)
.typeBodyStrongLarge(theme)
.foregroundStyle(theme.colors.colorContentDefault.color(for: colorScheme))
.padding(.vertical, theme.spaces.spacePaddingInlineShort)
Expand All @@ -55,7 +56,7 @@ struct ShowcaseCode: View {
.foregroundColor(theme.colors.colorSurfaceBrandPrimary.color(for: colorScheme))
.frame(width: 20, height: 20)
.padding(.trailing, theme.spaces.spacePaddingInlineMedium)
.accessibilityLabel("app_tokens_code_visibility_button_a11y")
.accessibilityLabel("app_common_viewCodeExample_label_a11y")
}
}
.buttonStyle(PlainButtonStyle())
Expand Down Expand Up @@ -85,7 +86,7 @@ struct ShowcaseCode: View {
.frame(width: 24, height: 24)
.padding(.trailing, theme.spaces.spacePaddingInlineMedium)
.alignmentGuide(.firstTextBaseline) { $0[.bottom] * 0.7 }
.accessibilityLabel("app_tokens_code_copy_button_a11y")
.accessibilityLabel("app_common_copyCode_a11y")
}
})
}
Expand All @@ -94,7 +95,7 @@ struct ShowcaseCode: View {
.padding(.leading, theme.spaces.spacePaddingInlineMedium)
.background(theme.colors.colorBgSecondary.color(for: colorScheme))
.accessibilityElement(children: .combine)
.accessibilityHint("app_tokens_code_copy_button_a11y")
.accessibilityHint("app_common_copyCode_a11y")
.overlay(
Rectangle()
.opacity(theme.opacities.opacityInvisible)
Expand Down
12 changes: 8 additions & 4 deletions Showcase/Showcase/Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
// Software description: A SwiftUI components library with code examples for Orange Unified Design System
//

// MARK: - Common
"app_common_viewCodeExample_label_a11y" = "Toggle code visibility";
"app_common_copyCode_a11y" = "Copy code";

// MARK: - bottomBar

"app_bottomBar_components_label" = "Components";
Expand All @@ -27,6 +31,8 @@

// MARK: - Tokens Screen

"app_tokens_common_viewCodeExample_label" = "View token code example";

"app_tokens_border_label" = "Border";
"app_tokens_border_width_label" = "Width";
"app_tokens_border_radius_label" = "Radius";
Expand Down Expand Up @@ -70,11 +76,9 @@
"app_tokens_typography_label" = "Font";
"app_tokens_typography_description_text" = "Font is our system of fonts and text styles. They enhance communication and reinforce the brand style.";

"app_tokens_code_title_label" = "View token code example";
"app_tokens_code_visibility_button_a11y" = "Toggle code visibility";
"app_tokens_code_copy_button_a11y" = "Copy code to clipboard";

// MARK: - Component Screen

"app_components_common_viewCodeExample_label" = "View component code example";

"app_component_emptyContent_text" = "No content";
"app_component_emptyContent_description_text" = "This content is under construction and will be available very soon";

0 comments on commit 327475d

Please sign in to comment.