Use semantics colors.
This commit is contained in:
parent
92dfcc60ee
commit
4660fe428d
1 changed files with 3 additions and 20 deletions
|
|
@ -14,48 +14,31 @@ import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import io.element.android.compound.annotations.CoreColorToken
|
|
||||||
import io.element.android.compound.theme.ElementTheme
|
import io.element.android.compound.theme.ElementTheme
|
||||||
import io.element.android.compound.tokens.generated.internal.DarkColorTokens
|
|
||||||
import io.element.android.compound.tokens.generated.internal.LightColorTokens
|
|
||||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||||
import io.element.android.libraries.designsystem.theme.components.Text
|
import io.element.android.libraries.designsystem.theme.components.Text
|
||||||
|
|
||||||
@OptIn(CoreColorToken::class)
|
|
||||||
@Composable
|
@Composable
|
||||||
fun BetaLabel(
|
fun BetaLabel(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val (backgroundColor, borderColor, textColor) = if (ElementTheme.isLightTheme) {
|
|
||||||
listOf(
|
|
||||||
LightColorTokens.colorGreen300,
|
|
||||||
LightColorTokens.colorGreen700,
|
|
||||||
LightColorTokens.colorGreen900,
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
listOf(
|
|
||||||
DarkColorTokens.colorGreen300,
|
|
||||||
DarkColorTokens.colorGreen700,
|
|
||||||
DarkColorTokens.colorGreen900,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
val shape = RoundedCornerShape(size = 6.dp)
|
val shape = RoundedCornerShape(size = 6.dp)
|
||||||
Text(
|
Text(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.border(
|
.border(
|
||||||
width = 1.dp,
|
width = 1.dp,
|
||||||
color = borderColor,
|
color = ElementTheme.colors.borderInfoSubtle,
|
||||||
shape = shape,
|
shape = shape,
|
||||||
)
|
)
|
||||||
.background(
|
.background(
|
||||||
color = backgroundColor,
|
color = ElementTheme.colors.bgInfoSubtle,
|
||||||
shape = shape,
|
shape = shape,
|
||||||
)
|
)
|
||||||
.padding(horizontal = 8.dp, vertical = 4.dp),
|
.padding(horizontal = 8.dp, vertical = 4.dp),
|
||||||
text = "BETA",
|
text = "BETA",
|
||||||
style = ElementTheme.typography.fontBodySmMedium,
|
style = ElementTheme.typography.fontBodySmMedium,
|
||||||
color = textColor,
|
color = ElementTheme.colors.textInfoPrimary,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue