-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add dimension tokens in the demo app (#147)
- Loading branch information
Showing
30 changed files
with
2,015 additions
and
1,210 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
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,30 @@ | ||
/* | ||
* Software Name: OUDS Android | ||
* 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. | ||
* | ||
* Software description: Android library of reusable graphical components | ||
*/ | ||
|
||
package com.orange.ouds.app.ui.tokens | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.TextStyle | ||
import androidx.compose.ui.unit.Dp | ||
import com.orange.ouds.app.R | ||
|
||
data class Token<T>(val name: String, val value: T) { | ||
val literalValue: String | ||
@Composable | ||
get() = when (value) { | ||
is Float -> stringResource(id = R.string.app_tokens_floatFormat_label, value) | ||
is Dp -> stringResource(id = R.string.app_tokens_dpFormat_label, value.toString().replace(".0.dp", "").substringBeforeLast(".dp")) | ||
is TextStyle -> stringResource(id = R.string.app_tokens_spFormat_label, value.fontSize.toString().replace(".0.sp", "").substringBeforeLast(".sp")) | ||
else -> value.toString() | ||
} | ||
} |
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
Oops, something went wrong.