-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move TypographyPreview to prod so that the preview can be rendered in…
… Android Studio.
- Loading branch information
Showing
2 changed files
with
51 additions
and
36 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
compound/src/main/kotlin/io/element/android/compound/previews/Typography.kt
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,49 @@ | ||
/* | ||
* Copyright 2025 New Vector Ltd. | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial | ||
* Please see LICENSE files in the repository root for full details. | ||
*/ | ||
|
||
package io.element.android.compound.previews | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.material3.Surface | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
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 | ||
|
||
@Preview | ||
@Composable | ||
fun TypographyPreview() = ElementTheme { | ||
Surface { | ||
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) { | ||
with(ElementTheme.materialTypography) { | ||
TypographyTokenPreview(displayLarge, "Display large") | ||
TypographyTokenPreview(displayMedium, "Display medium") | ||
TypographyTokenPreview(displaySmall, "Display small") | ||
TypographyTokenPreview(headlineLarge, "Headline large") | ||
TypographyTokenPreview(headlineMedium, "Headline medium") | ||
TypographyTokenPreview(headlineSmall, "Headline small") | ||
TypographyTokenPreview(titleLarge, "Title large") | ||
TypographyTokenPreview(titleMedium, "Title medium") | ||
TypographyTokenPreview(titleSmall, "Title small") | ||
TypographyTokenPreview(bodyLarge, "Body large") | ||
TypographyTokenPreview(bodyMedium, "Body medium") | ||
TypographyTokenPreview(bodySmall, "Body small") | ||
TypographyTokenPreview(labelLarge, "Label large") | ||
TypographyTokenPreview(labelMedium, "Label medium") | ||
TypographyTokenPreview(labelSmall, "Label small") | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
private fun TypographyTokenPreview(style: TextStyle, text: String) { | ||
Text(text = text, style = style) | ||
} |
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