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

feat: add dimension tokens in the demo app #147

Merged
merged 32 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6531e37
Add border tokens in the demo app
paulinea Oct 16, 2024
234a974
Review: Change dashedBorder modifier signature
paulinea Oct 17, 2024
db9c8d0
Review: Move defaultIllustrationSize variable in the companion object…
paulinea Oct 17, 2024
84c3273
Add ic_spacing icon
paulinea Oct 17, 2024
036fa73
Start adding dimension tokens in demo app
paulinea Oct 18, 2024
d6e1bf1
Fix subcategories detail display
paulinea Oct 18, 2024
84f5ada
Reorder OudsSizeIconWithTextKeyToken
paulinea Oct 21, 2024
ee12492
Display dimension size tokens
paulinea Oct 21, 2024
0bb2e13
Display all spacing tokens in the demo app
paulinea Oct 21, 2024
7d7fbfa
Apply filter before calling private composable
paulinea Oct 22, 2024
4d98607
Reorder properties
paulinea Oct 22, 2024
727433d
Update illustrations for spacing inline with icon
paulinea Oct 22, 2024
e433d19
Rename spacing into space
paulinea Oct 23, 2024
5f6dce1
Rename strings
paulinea Oct 23, 2024
b1654ac
Add WithArrow tokens illustrations
paulinea Oct 23, 2024
d7b9d40
Replace hardcoded spaces by tokens
paulinea Oct 24, 2024
f8ec679
Factorize some code
paulinea Oct 24, 2024
08000a5
Improve size and space key tokens organization
paulinea Oct 25, 2024
5f0c15c
Review: Use object instead of class
paulinea Nov 4, 2024
c627d3b
Review: Add nested data classes in OudsSizes and OudsSpaces
paulinea Nov 4, 2024
eeb7232
Review: Create nested enum classes for space key tokens
paulinea Nov 4, 2024
8854344
Review: Add ic_chevron_down to NOTICE.txt
paulinea Nov 4, 2024
6c73395
Review: Add missing copyrights
paulinea Nov 4, 2024
2996c7a
Review: Update preview
paulinea Nov 4, 2024
96441d4
Review: Compute isSubcategory property at runtime
paulinea Nov 4, 2024
fdee1da
Review: Replace SizeIconWithLabel by SizeIconWithText
paulinea Nov 4, 2024
efb0805
Review: Fix body and label text styles
paulinea Nov 4, 2024
585fe3c
Review: Simplify code
paulinea Nov 4, 2024
415998b
Review: Manage token property illustrations in the same file
paulinea Nov 4, 2024
e0e1bc6
Review: Split tokens with icon/arrow and add corresponding illustrations
paulinea Nov 4, 2024
57a101d
Review: Rename iconWithLabel by iconWithText
paulinea Nov 8, 2024
550678d
Review: Rename composable
paulinea Nov 8, 2024
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
Prev Previous commit
Next Next commit
Update illustrations for spacing inline with icon
  • Loading branch information
paulinea authored and florentmaitre committed Nov 8, 2024
commit 727433d1a9e1e9513372ef870295cf6d93c574bf
1 change: 1 addition & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Any use or displaying shall constitute an infringement under intellectual proper
app/src/main/res/drawable/ic_border.xml
app/src/main/res/drawable/ic_component_atom.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_filter_effects.xml
app/src/main/res/drawable/ic_info.xml
app/src/main/res/drawable/ic_layers.xml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ private fun TokenIllustration(tokenProperty: TokenProperty, token: Token<Any>) =
is TokenProperty.SizeIconDecorative -> tokenProperty.Illustration(size = token.value as Dp)
is TokenProperty.SizeIconWithLabel -> tokenProperty.Illustration(size = token.value as Dp, token.name)
is TokenProperty.SpacingColumnGap -> tokenProperty.Illustration(size = token.value as Dp)
is TokenProperty.SpacingPaddingInline -> tokenProperty.Illustration(size = token.value as Dp)
is TokenProperty.SpacingPaddingInline -> tokenProperty.Illustration(size = token.value as Dp, token.name)
is TokenProperty.SpacingPaddingInset -> tokenProperty.Illustration(size = token.value as Dp)
is TokenProperty.SpacingPaddingStack -> tokenProperty.Illustration(size = token.value as Dp)
is TokenProperty.SpacingFixed -> tokenProperty.Illustration(size = token.value as Dp)
Expand Down
26 changes: 25 additions & 1 deletion app/src/main/java/com/orange/ouds/app/ui/tokens/TokenProperty.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
Expand Down Expand Up @@ -233,7 +234,30 @@ sealed class TokenProperty(
tokens = { OudsSpacingPaddingInlineKeyToken.entries.map { Token(it.name, it.value) } }
) {
@Composable
fun Illustration(size: Dp) = SpacingIllustration(size = size)
fun Illustration(size: Dp, tokenName: String) = when {
tokenName.contains("WithIcon") -> {
Row(
modifier = Modifier
.size(defaultIllustrationSize)
.background(color = OudsColorKeyToken.OnSurface.value), //TODO use BgEmphasizedPrimary token when available
verticalAlignment = Alignment.CenterVertically
) {
Box(
modifier = Modifier
.fillMaxHeight()
.width(width = size)
.background(Color(0xFF26B2FF)) //TODO use AlwaysInfo token when available
)
Image(
modifier = Modifier.padding(horizontal = 1.dp),
painter = painterResource(R.drawable.ic_design_token_figma_no_padding),
contentDescription = null,
contentScale = ContentScale.None
)
}
}
else -> SpacingIllustration(size = size)
}
}

data object SpacingPaddingInset : TokenProperty(
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_design_token_figma_no_padding.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
florentmaitre marked this conversation as resolved.
Show resolved Hide resolved
android:width="22dp"
android:height="24dp"
android:viewportWidth="22"
android:viewportHeight="24">
<path
android:pathData="M21.594,6.306C21.586,6.19 21.549,6.078 21.487,5.979C21.426,5.88 21.34,5.798 21.239,5.74L11.349,0.093C11.242,0.032 11.121,0 10.998,0C10.875,0 10.755,0.032 10.648,0.093L0.757,5.74C0.649,5.802 0.56,5.892 0.497,5.999C0.435,6.107 0.402,6.229 0.401,6.353V17.647C0.401,17.772 0.434,17.894 0.497,18.002C0.559,18.11 0.649,18.199 0.757,18.26L10.648,23.908C10.755,23.968 10.875,24 10.998,24C11.121,24 11.242,23.968 11.349,23.908L21.239,18.26C21.347,18.199 21.437,18.11 21.5,18.002C21.562,17.894 21.595,17.772 21.595,17.648C21.579,17.59 21.609,6.356 21.594,6.306ZM10.998,1.519L19.465,6.353L14.277,9.315C12.639,7.26 9.357,7.261 7.72,9.315L2.532,6.353L10.998,1.519ZM13.824,12C13.832,13.567 12.519,14.835 10.998,14.824C9.478,14.835 8.164,13.567 8.172,12C8.16,10.473 9.444,9.165 10.998,9.177C12.553,9.165 13.837,10.473 13.824,12ZM10.292,22.078L1.814,17.238V7.57L7.018,10.541C6.08,12.992 7.743,15.789 10.292,16.177V22.078ZM20.183,17.238L11.705,22.078V16.177C14.253,15.789 15.917,12.992 14.979,10.541L20.183,7.57V17.238Z"
android:fillColor="#26B2FF"
android:fillType="evenOdd"/>
</vector>