From 8d2a683fbcfba227319366015219e3ac76854ccb Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Sat, 20 Dec 2025 18:23:50 +0100 Subject: [PATCH] Add preview for ElementTheme.typography values. --- .../android/compound/previews/Typography.kt | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/libraries/compound/src/main/kotlin/io/element/android/compound/previews/Typography.kt b/libraries/compound/src/main/kotlin/io/element/android/compound/previews/Typography.kt index 761bf12cdf..2f2ef942a7 100644 --- a/libraries/compound/src/main/kotlin/io/element/android/compound/previews/Typography.kt +++ b/libraries/compound/src/main/kotlin/io/element/android/compound/previews/Typography.kt @@ -17,13 +17,14 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import io.element.android.compound.theme.ElementTheme +import io.element.android.compound.tokens.compoundTypography @Preview @Composable internal fun TypographyPreview() = ElementTheme { Surface { Column(verticalArrangement = Arrangement.spacedBy(8.dp)) { - with(ElementTheme.materialTypography) { + with(compoundTypography) { TypographyTokenPreview(displayLarge, "Display large") TypographyTokenPreview(displayMedium, "Display medium") TypographyTokenPreview(displaySmall, "Display small") @@ -44,6 +45,33 @@ internal fun TypographyPreview() = ElementTheme { } } +@Preview +@Composable +internal fun CompoundTypographyPreview() = ElementTheme { + Surface { + Column(verticalArrangement = Arrangement.spacedBy(8.dp)) { + with(ElementTheme.typography) { + TypographyTokenPreview(fontHeadingXlBold, "fontHeadingXlBold") + TypographyTokenPreview(fontHeadingXlRegular, "fontHeadingXlRegular") + TypographyTokenPreview(fontHeadingLgBold, "fontHeadingLgBold") + TypographyTokenPreview(fontHeadingLgRegular, "fontHeadingLgRegular") + TypographyTokenPreview(fontHeadingMdBold, "fontHeadingMdBold") + TypographyTokenPreview(fontHeadingMdRegular, "fontHeadingMdRegular") + TypographyTokenPreview(fontHeadingSmMedium, "fontHeadingSmMedium") + TypographyTokenPreview(fontHeadingSmRegular, "fontHeadingSmRegular") + TypographyTokenPreview(fontBodyLgMedium, "fontBodyLgMedium") + TypographyTokenPreview(fontBodyLgRegular, "fontBodyLgRegular") + TypographyTokenPreview(fontBodyMdMedium, "fontBodyMdMedium") + TypographyTokenPreview(fontBodyMdRegular, "fontBodyMdRegular") + TypographyTokenPreview(fontBodySmMedium, "fontBodySmMedium") + TypographyTokenPreview(fontBodySmRegular, "fontBodySmRegular") + TypographyTokenPreview(fontBodyXsMedium, "fontBodyXsMedium") + TypographyTokenPreview(fontBodyXsRegular, "fontBodyXsRegular") + } + } + } +} + @Composable private fun TypographyTokenPreview(style: TextStyle, text: String) { Text(text = text, style = style)