Add preview for ElementTheme.typography values.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user