-
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.
Loading status checks…
review: a11y group title and picker in configuration screen
Showing
5 changed files
with
64 additions
and
47 deletions.
There are no files selected for viewing
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
42 changes: 42 additions & 0 deletions
42
DesignToolbox/DesignToolbox/Pages/Utils/DesignToolboxChoicePicker.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,42 @@ | ||
// | ||
// Software Name: OUDS iOS | ||
// SPDX-FileCopyrightText: Copyright (c) Orange SA | ||
// SPDX-License-Identifier: MIT | ||
// | ||
// This software is distributed under the MIT license, | ||
// the text of which is available at https://opensource.org/license/MIT/ | ||
// or see the "LICENSE" file for more details. | ||
// | ||
// Authors: See CONTRIBUTORS.txt | ||
// Software description: A SwiftUI components library with code examples for Orange Unified Design System | ||
// | ||
|
||
import OUDS | ||
import OUDSTokensSemantic | ||
import SwiftUI | ||
|
||
struct DesignToolboxChoicePicker<Content, Selection>: View where Content: View, Selection: Hashable { | ||
|
||
@Environment(\.theme) private var theme | ||
@Environment(\.colorScheme) private var colorScheme | ||
|
||
let title: String | ||
let selection: Binding<Selection> | ||
let content: () -> Content | ||
|
||
var body: some View { | ||
VStack(alignment: .leading) { | ||
Text(LocalizedStringKey(title)) | ||
.typeHeadingMedium(theme) | ||
.foregroundStyle(theme.colors.colorContentDefault.color(for: colorScheme)) | ||
.accessibilityHidden(true) | ||
|
||
Picker(LocalizedStringKey(title), selection: selection) { | ||
content() | ||
} | ||
.pickerStyle(.segmented) | ||
.accessibilityElement(children: .contain) | ||
.accessibilityLabel(LocalizedStringKey(title)) | ||
} | ||
} | ||
} |