Skip to content

Commit

Permalink
Use OudsTheme tokens instead of key tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
florentmaitre committed Jan 9, 2025
1 parent 5fbcb90 commit 75be6f9
Show file tree
Hide file tree
Showing 30 changed files with 616 additions and 1,058 deletions.
5 changes: 2 additions & 3 deletions app/src/main/java/com/orange/ouds/app/ui/BottomBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,15 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import com.orange.ouds.app.R
import com.orange.ouds.core.theme.value
import com.orange.ouds.core.theme.OudsTheme
import com.orange.ouds.core.utilities.OudsPreview
import com.orange.ouds.foundation.utilities.UiModePreviews
import com.orange.ouds.theme.tokens.OudsColorKeyToken

@Composable
fun BottomBar(currentRoute: String, navigateToRoute: (String) -> Unit) {
val items = BottomBarItem.entries.toTypedArray()
NavigationBar(
containerColor = OudsColorKeyToken.Background.Secondary.value, //TODO Temporary color. Waiting for Material colors from Maxime.
containerColor = OudsTheme.colorScheme.backgroundColors.secondary, //TODO Temporary color. Waiting for Material colors from Maxime.
content = {
items.forEach { item ->
NavigationBarItem(
Expand Down
13 changes: 5 additions & 8 deletions app/src/main/java/com/orange/ouds/app/ui/MainScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,13 @@ import com.orange.ouds.app.R
import com.orange.ouds.app.ui.navigation.appNavGraph
import com.orange.ouds.app.ui.utilities.isDarkModeEnabled
import com.orange.ouds.core.theme.OudsTheme
import com.orange.ouds.core.theme.value
import com.orange.ouds.core.utilities.OudsPreview
import com.orange.ouds.foundation.extensions.orElse
import com.orange.ouds.foundation.utilities.UiModePreviews
import com.orange.ouds.theme.OudsThemeContract
import com.orange.ouds.theme.orange.ORANGE_THEME_NAME
import com.orange.ouds.theme.orange.OrangeTheme
import com.orange.ouds.theme.orangecountry.OrangeCountryTheme
import com.orange.ouds.theme.tokens.OudsColorKeyToken
import com.orange.ouds.theme.tokens.OudsSpaceKeyToken
import com.orange.ouds.theme.whitelabel.WhiteLabelTheme

@Composable
Expand Down Expand Up @@ -155,14 +152,14 @@ private fun ChangeThemeDialog(themeManager: ThemeManager, dismissDialog: () -> U
Dialog(onDismissRequest = dismissDialog) {
Column(
modifier = Modifier
.background(OudsColorKeyToken.Background.Secondary.value)
.background(OudsTheme.colorScheme.backgroundColors.secondary)
.selectableGroup()
) {
Text(
text = stringResource(R.string.app_themeDialog_label),
modifier = Modifier
.padding(top = OudsSpaceKeyToken.Fixed.Medium.value, bottom = OudsSpaceKeyToken.Fixed.Short.value)
.padding(horizontal = OudsSpaceKeyToken.Fixed.Medium.value),
.padding(top = OudsTheme.spaces.fixed.medium, bottom = OudsTheme.spaces.fixed.short)
.padding(horizontal = OudsTheme.spaces.fixed.medium),
style = MaterialTheme.typography.titleLarge
)
themeManager.availableThemes.forEach { theme ->
Expand All @@ -182,7 +179,7 @@ private fun ChangeThemeDialog(themeManager: ThemeManager, dismissDialog: () -> U
},
role = Role.RadioButton
)
.padding(horizontal = OudsSpaceKeyToken.Fixed.Medium.value),
.padding(horizontal = OudsTheme.spaces.fixed.medium),
verticalAlignment = Alignment.CenterVertically
) {
RadioButton(
Expand All @@ -192,7 +189,7 @@ private fun ChangeThemeDialog(themeManager: ThemeManager, dismissDialog: () -> U
Text(
text = theme.name,
style = MaterialTheme.typography.bodyLarge,
modifier = Modifier.padding(start = OudsSpaceKeyToken.Fixed.Medium.value)
modifier = Modifier.padding(start = OudsTheme.spaces.fixed.medium)
)
}
}
Expand Down
10 changes: 4 additions & 6 deletions app/src/main/java/com/orange/ouds/app/ui/TopBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@ import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.traversalIndex
import com.orange.ouds.app.R
import com.orange.ouds.app.ui.utilities.isDarkModeEnabled
import com.orange.ouds.core.theme.value
import com.orange.ouds.core.theme.OudsTheme
import com.orange.ouds.core.utilities.OudsPreview
import com.orange.ouds.foundation.utilities.UiModePreviews
import com.orange.ouds.theme.tokens.OudsColorKeyToken
import com.orange.ouds.theme.tokens.OudsTypographyKeyToken


@Composable
Expand Down Expand Up @@ -70,17 +68,17 @@ private fun TopBar(
Image(
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = stringResource(id = R.string.app_common_back_a11y),
colorFilter = ColorFilter.tint(OudsColorKeyToken.Content.Default.value)
colorFilter = ColorFilter.tint(OudsTheme.colorScheme.contentColors.default)
)
}
}
},
title = {
Text(
text = title,
color = OudsColorKeyToken.Content.Default.value,
color = OudsTheme.colorScheme.contentColors.default,
modifier = Modifier.semantics { traversalIndex = -1f },
style = OudsTypographyKeyToken.Heading.Medium.value
style = OudsTheme.typography.headingMedium
)
},
actions = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import com.orange.ouds.app.ui.utilities.composable.LargeCard
import com.orange.ouds.app.ui.utilities.composable.Screen
import com.orange.ouds.core.theme.value
import com.orange.ouds.core.theme.OudsTheme
import com.orange.ouds.core.utilities.OudsPreview
import com.orange.ouds.foundation.utilities.UiModePreviews
import com.orange.ouds.theme.tokens.OudsSpaceKeyToken

@Composable
fun ComponentsScreen(onComponentClick: (Long) -> Unit) {
Expand All @@ -43,8 +42,8 @@ private fun ComponentsScreen(components: List<Component>, onComponentClick: (Lon
modifier = Modifier
.fillMaxSize()
.verticalScroll(rememberScrollState())
.padding(OudsSpaceKeyToken.Fixed.Medium.value),
verticalArrangement = Arrangement.spacedBy(OudsSpaceKeyToken.Fixed.Medium.value)
.padding(OudsTheme.spaces.fixed.medium),
verticalArrangement = Arrangement.spacedBy(OudsTheme.spaces.fixed.medium)
) {
components.forEach { component ->
LargeCard(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* Software description: Android library of reusable graphical components
*/

package com.orange.ouds.app.ui.components.button

import androidx.compose.foundation.background
Expand All @@ -35,10 +35,8 @@ import com.orange.ouds.app.ui.utilities.composable.DetailScreenDescription
import com.orange.ouds.core.component.button.OudsButton
import com.orange.ouds.core.theme.OudsTheme
import com.orange.ouds.core.theme.OudsThemeTweak
import com.orange.ouds.core.theme.value
import com.orange.ouds.core.utilities.OudsPreview
import com.orange.ouds.foundation.utilities.UiModePreviews
import com.orange.ouds.theme.tokens.OudsSpaceKeyToken


@OptIn(ExperimentalMaterial3Api::class)
Expand All @@ -54,7 +52,7 @@ fun ButtonDemoScreen() = DemoScreen(rememberButtonDemoState()) {
enabled = style == OudsButton.Style.Default
)
CustomizationChoiceChipsColumn(
modifier = Modifier.padding(top = OudsSpaceKeyToken.Fixed.Medium.value),
modifier = Modifier.padding(top = OudsTheme.spaces.fixed.medium),
label = stringResource(R.string.app_components_button_hierarchy_label),
chipsLabels = OudsButton.Hierarchy.entries.map { it.name },
selectedChipIndex = OudsButton.Hierarchy.entries.indexOf(hierarchy),
Expand All @@ -68,14 +66,14 @@ fun ButtonDemoScreen() = DemoScreen(rememberButtonDemoState()) {
)
}
CustomizationChoiceChipsColumn(
modifier = Modifier.padding(top = OudsSpaceKeyToken.Fixed.Medium.value),
modifier = Modifier.padding(top = OudsTheme.spaces.fixed.medium),
label = stringResource(R.string.app_components_button_style_label),
chipsLabels = styles.map { it::class.simpleName.orEmpty() },
selectedChipIndex = styles.indexOf(style),
onSelectionChange = { id -> style = styles[id] }
)
CustomizationChoiceChipsColumn(
modifier = Modifier.padding(top = OudsSpaceKeyToken.Fixed.Medium.value),
modifier = Modifier.padding(top = OudsTheme.spaces.fixed.medium),
label = stringResource(R.string.app_components_button_layout_label),
chipsLabels = ButtonDemoState.Layout.entries.map { stringResource(it.labelRes) },
selectedChipIndex = ButtonDemoState.Layout.entries.indexOf(layout),
Expand All @@ -85,7 +83,7 @@ fun ButtonDemoScreen() = DemoScreen(rememberButtonDemoState()) {
) {
Column(modifier = Modifier.fillMaxWidth()) {
DetailScreenDescription(
modifier = Modifier.padding(all = OudsSpaceKeyToken.Fixed.Medium.value),
modifier = Modifier.padding(all = OudsTheme.spaces.fixed.medium),
descriptionRes = Component.Button.descriptionRes
)
ButtonDemo(state = this@DemoScreen)
Expand All @@ -101,7 +99,7 @@ private fun ButtonDemo(state: ButtonDemoState) {
Box(
modifier = Modifier
.background(OudsTheme.colorScheme.backgroundColors.primary)
.padding(all = OudsSpaceKeyToken.Fixed.Medium.value)
.padding(all = OudsTheme.spaces.fixed.medium)
.fillMaxWidth(),
contentAlignment = Alignment.Center
) {
Expand Down
Loading

0 comments on commit 75be6f9

Please sign in to comment.