Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update tokens #229

Merged
merged 7 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ app/src/main/res/drawable/ic_chevron_down.xml
app/src/main/res/drawable/ic_component_atom.xml
app/src/main/res/drawable/ic_copy.xml
app/src/main/res/drawable/ic_design_token_figma.xml
app/src/main/res/drawable/ic_design_token_figma_no_padding.xml
app/src/main/res/drawable/ic_dimension.xml
app/src/main/res/drawable/ic_filter_effects.xml
app/src/main/res/drawable/ic_info.xml
Expand Down
3 changes: 3 additions & 0 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,13 +23,16 @@ 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.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.
content = {
items.forEach { item ->
NavigationBarItem(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fun ComponentsScreen() {
.padding(top = OudsSpaceKeyToken.Fixed.Medium.value)
.width(OudsGridKeyToken.Margin.value)
.height(OudsGridKeyToken.ColumnGap.value)
.background(OudsColorKeyToken.Background.Brand.Primary.value)
.background(OudsColorKeyToken.Content.Brand.Primary.value)
)
}
}
Expand Down
15 changes: 4 additions & 11 deletions app/src/main/java/com/orange/ouds/app/ui/tokens/TokenCategory.kt
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,10 @@ sealed class TokenCategory<T>(
TokenProperty.ColorAlways,
TokenProperty.ColorBackground,
TokenProperty.ColorBorder,
TokenProperty.ColorBrand,
TokenProperty.ColorContent,
TokenProperty.ColorDecorative,
TokenProperty.ColorElevation,
TokenProperty.ColorGradient,
TokenProperty.ColorOverlay,
TokenProperty.ColorSurface,
)
)

Expand All @@ -87,24 +86,18 @@ sealed class TokenCategory<T>(
TokenProperty.SpaceScaled,
TokenProperty.SpaceFixed,
TokenProperty.SpacePaddingInline,
TokenProperty.SpacePaddingInlineWithIcon,
TokenProperty.SpacePaddingInlineWithArrow,
TokenProperty.SpacePaddingStack,
TokenProperty.SpacePaddingStackWithIcon,
TokenProperty.SpacePaddingInset,
TokenProperty.SpaceColumnGap,
TokenProperty.SpaceColumnGapWithIcon,
TokenProperty.SpaceColumnGapWithArrow,
TokenProperty.SpaceRowGap,
TokenProperty.SpaceRowGapWithIcon
),
)

data object Size : TokenCategory<Size>(
R.string.app_tokens_dimension_size_label,
R.drawable.ic_dimension,
R.string.app_tokens_dimension_size_description_text,
getTokenValueCode<OudsSizeKeyToken.Icon.Decorative.Shortest>(),
getTokenValueCode<OudsSizeKeyToken.Icon.Decorative.ExtraExtraSmall>(),
listOf(TokenProperty.SizeIconDecorative, TokenProperty.SizeIconWithText),
)
}
Expand All @@ -129,7 +122,7 @@ sealed class TokenCategory<T>(
R.string.app_tokens_opacity_label,
R.drawable.ic_filter_effects,
R.string.app_tokens_opacity_description_text,
getTokenValueCode<OudsOpacityKeyToken.Transparent>(),
getTokenValueCode<OudsOpacityKeyToken.Invisible>(),
listOf(TokenProperty.Opacity)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ private fun TokenIllustration(tokenProperty: TokenProperty<*>, token: Token<*>)
is TokenProperty.BorderWidth -> BorderIllustrationBox(width = token.value() as Dp)
is TokenProperty.BorderRadius -> BorderIllustrationBox(shape = RoundedCornerShape(token.value() as Dp))
is TokenProperty.BorderStyle -> BorderIllustrationBox(style = token.value() as OudsBorderStyle)
is TokenProperty.ColorAction, TokenProperty.ColorAlways, TokenProperty.ColorBackground, TokenProperty.ColorBorder, TokenProperty.ColorBrand, TokenProperty.ColorContent,
TokenProperty.ColorElevation, TokenProperty.ColorGradient, TokenProperty.ColorDecorative -> BorderIllustrationBox(backgroundColor = token.value() as Color)
is TokenProperty.ColorAction, TokenProperty.ColorAlways, TokenProperty.ColorBackground, TokenProperty.ColorBorder, TokenProperty.ColorContent,
TokenProperty.ColorDecorative, TokenProperty.ColorOverlay, TokenProperty.ColorSurface -> BorderIllustrationBox(backgroundColor = token.value() as Color)
is TokenProperty.Opacity -> OpacityIllustrationBox(opacity = token.value() as Float)
is TokenProperty.Elevation -> ElevationIllustrationSurface(elevation = token.value() as Dp)
is TokenProperty.SizeIconDecorative -> SizeIconDecorativeIllustrationBox(size = token.value() as Dp)
Expand All @@ -222,13 +222,9 @@ private fun TokenIllustration(tokenProperty: TokenProperty<*>, token: Token<*>)
contentAlignment = Alignment.Center
)
TokenProperty.SpacePaddingInline -> SpaceIllustrationBox(size = token.value() as Dp)
TokenProperty.SpacePaddingInlineWithIcon, TokenProperty.SpaceColumnGapWithIcon -> SpaceWithIconIllustrationRow(size = token.value() as Dp)
TokenProperty.SpacePaddingInlineWithArrow, TokenProperty.SpaceColumnGapWithArrow -> SpaceWithArrowIllustrationRow(size = token.value() as Dp)
TokenProperty.SpacePaddingInset -> SpacePaddingInsetIllustrationBox(size = token.value() as Dp)
TokenProperty.SpacePaddingStack -> SpaceIllustrationBox(size = token.value() as Dp, orientation = SpaceOrientation.Vertical)
TokenProperty.SpaceRowGap -> SpaceIllustrationBox(size = token.value() as Dp, orientation = SpaceOrientation.Vertical, contentAlignment = Alignment.Center)
TokenProperty.SpaceRowGapWithIcon -> SpaceWithIconIllustrationColumn(size = token.value() as Dp, verticalArrangement = Arrangement.Bottom)
TokenProperty.SpacePaddingStackWithIcon -> SpaceWithIconIllustrationColumn(size = token.value() as Dp)
TokenProperty.Typography, TokenProperty.Grid -> Unit
}

Expand Down Expand Up @@ -277,7 +273,7 @@ private fun CodeColumn(codeExample: String, modifier: Modifier = Modifier) {
stateDescription = linkStateDescription
},
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(OudsSpaceKeyToken.PaddingInline.WithArrow.Short.value)
horizontalArrangement = Arrangement.spacedBy(OudsSpaceKeyToken.PaddingInline.Short.value)
) {
Text(
text = stringResource(R.string.app_tokens_viewCodeExample_label),
Expand All @@ -286,7 +282,7 @@ private fun CodeColumn(codeExample: String, modifier: Modifier = Modifier) {
Icon(
modifier = Modifier.rotate(linkArrowRotation),
painter = painterResource(R.drawable.ic_chevron_down),
tint = OudsColorKeyToken.Brand.Primary.Default.value,
tint = OudsColorKeyToken.Content.Brand.Primary.value,
contentDescription = null
)
}
Expand Down
54 changes: 6 additions & 48 deletions app/src/main/java/com/orange/ouds/app/ui/tokens/TokenProperty.kt
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ sealed class TokenProperty<T>(
categoryClass = TokenCategory.Color::class
)

data object ColorBrand : TokenProperty<TokenCategory.Color>(
nameRes = R.string.app_tokens_color_brand_label,
tokens = OudsColorKeyToken.Brand::class.getTokens(),
categoryClass = TokenCategory.Color::class
)

data object ColorContent : TokenProperty<TokenCategory.Color>(
nameRes = R.string.app_tokens_color_content_label,
tokens = OudsColorKeyToken.Content::class.getTokens(),
Expand All @@ -92,15 +86,15 @@ sealed class TokenProperty<T>(
categoryClass = TokenCategory.Color::class
)

data object ColorElevation : TokenProperty<TokenCategory.Color>(
nameRes = R.string.app_tokens_color_elevation_label,
tokens = OudsColorKeyToken.Elevation::class.getTokens(),
data object ColorOverlay : TokenProperty<TokenCategory.Color>(
nameRes = R.string.app_tokens_color_overlay_label,
tokens = OudsColorKeyToken.Overlay::class.getTokens(),
categoryClass = TokenCategory.Color::class
)

data object ColorGradient : TokenProperty<TokenCategory.Color>(
nameRes = R.string.app_tokens_color_gradient_label,
tokens = OudsColorKeyToken.Gradient::class.getTokens(),
data object ColorSurface : TokenProperty<TokenCategory.Color>(
nameRes = R.string.app_tokens_color_surface_label,
tokens = OudsColorKeyToken.Surface::class.getTokens(),
categoryClass = TokenCategory.Color::class
)

Expand Down Expand Up @@ -154,18 +148,6 @@ sealed class TokenProperty<T>(
categoryClass = TokenCategory.Dimension.Space::class
)

data object SpaceColumnGapWithIcon : TokenProperty<TokenCategory.Dimension.Space>(
nameRes = R.string.app_tokens_dimension_space_columnGapWithIcon_label,
tokens = OudsSpaceKeyToken.ColumnGap.WithIcon::class.getTokens(),
categoryClass = TokenCategory.Dimension.Space::class
)

data object SpaceColumnGapWithArrow : TokenProperty<TokenCategory.Dimension.Space>(
nameRes = R.string.app_tokens_dimension_space_columnGapWithArrow_label,
tokens = OudsSpaceKeyToken.ColumnGap.WithArrow::class.getTokens(),
categoryClass = TokenCategory.Dimension.Space::class
)

data object SpaceFixed : TokenProperty<TokenCategory.Dimension.Space>(
nameRes = R.string.app_tokens_dimension_space_fixed_label,
tokens = OudsSpaceKeyToken.Fixed::class.getTokens(),
Expand All @@ -178,18 +160,6 @@ sealed class TokenProperty<T>(
categoryClass = TokenCategory.Dimension.Space::class
)

data object SpacePaddingInlineWithIcon : TokenProperty<TokenCategory.Dimension.Space>(
nameRes = R.string.app_tokens_dimension_space_paddingInlineWithIcon_label,
tokens = OudsSpaceKeyToken.PaddingInline.WithIcon::class.getTokens(),
categoryClass = TokenCategory.Dimension.Space::class
)

data object SpacePaddingInlineWithArrow : TokenProperty<TokenCategory.Dimension.Space>(
nameRes = R.string.app_tokens_dimension_space_paddingInlineWithArrow_label,
tokens = OudsSpaceKeyToken.PaddingInline.WithArrow::class.getTokens(),
categoryClass = TokenCategory.Dimension.Space::class
)

data object SpacePaddingInset : TokenProperty<TokenCategory.Dimension.Space>(
nameRes = R.string.app_tokens_dimension_space_paddingInset_label,
tokens = OudsSpaceKeyToken.Inset::class.getTokens(),
Expand All @@ -202,24 +172,12 @@ sealed class TokenProperty<T>(
categoryClass = TokenCategory.Dimension.Space::class
)

data object SpacePaddingStackWithIcon : TokenProperty<TokenCategory.Dimension.Space>(
nameRes = R.string.app_tokens_dimension_space_paddingStackWithIcon_label,
tokens = OudsSpaceKeyToken.PaddingBlock.WithIcon::class.getTokens(),
categoryClass = TokenCategory.Dimension.Space::class
)

data object SpaceRowGap : TokenProperty<TokenCategory.Dimension.Space>(
nameRes = R.string.app_tokens_dimension_space_rowGap_label,
tokens = OudsSpaceKeyToken.RowGap::class.getTokens(recursive = false),
categoryClass = TokenCategory.Dimension.Space::class
)

data object SpaceRowGapWithIcon : TokenProperty<TokenCategory.Dimension.Space>(
nameRes = R.string.app_tokens_dimension_space_rowGapWithIcon_label,
tokens = OudsSpaceKeyToken.RowGap.WithIcon::class.getTokens(),
categoryClass = TokenCategory.Dimension.Space::class
)

data object SpaceScaled : TokenProperty<TokenCategory.Dimension.Space>(
nameRes = R.string.app_tokens_dimension_space_scaled_label,
tokens = OudsSpaceKeyToken.Scaled::class.getTokens(),
Expand Down
Loading
Loading