Updated on 2026-08-14
This commit is contained in:
parent
519f5332f1
commit
8962f8d333
27 changed files with 87 additions and 76 deletions
|
|
@ -25,7 +25,6 @@ import androidx.compose.ui.unit.Dp
|
|||
import androidx.compose.ui.unit.dp
|
||||
import com.tangem.core.ui.R
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TangemTypography
|
||||
|
||||
/**
|
||||
* [Show in Figma](https://www.figma.com/file/14ISV23YB1yVW1uNVwqrKv/Android?node-id=213%3A218&t=TmfD6UBHPg9uYfev-4)
|
||||
|
|
@ -103,7 +102,7 @@ private fun TangemTextField(
|
|||
if (!label.isNullOrEmpty()) {
|
||||
Text(
|
||||
text = label,
|
||||
style = TangemTheme.typography.caption,
|
||||
style = TangemTheme.typography.caption2,
|
||||
color = colors.labelColor(
|
||||
enabled = enabled,
|
||||
error = isError,
|
||||
|
|
@ -161,7 +160,7 @@ private fun TangemTextField(
|
|||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
text = caption,
|
||||
style = TangemTypography.body1,
|
||||
style = TangemTheme.typography.body1,
|
||||
color = colors.captionColor(enabled = enabled, isError = isError).value,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ private fun SubtitleView(subtitle: String, icon: Painter?) {
|
|||
text = subtitle,
|
||||
color = TangemTheme.colors.text.secondary,
|
||||
maxLines = 1,
|
||||
style = TangemTheme.typography.caption,
|
||||
style = TangemTheme.typography.caption2,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ private fun TokenReceiveBottomSheetContent(content: TokenReceiveBottomSheetConfi
|
|||
text = stringResource(R.string.receive_bottom_sheet_warning_message_full, content.name),
|
||||
color = TangemTheme.colors.text.secondary,
|
||||
textAlign = TextAlign.Center,
|
||||
style = TangemTheme.typography.caption,
|
||||
style = TangemTheme.typography.caption2,
|
||||
)
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.spacedBy(TangemTheme.dimens.spacing16),
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ private fun TextsBlock(title: TextReference, subtitle: TextReference) {
|
|||
Text(
|
||||
text = subtitle.resolveReference(),
|
||||
color = TangemTheme.colors.text.tertiary,
|
||||
style = TangemTheme.typography.caption,
|
||||
style = TangemTheme.typography.caption2,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ private fun Subtitle(state: TransactionState, modifier: Modifier = Modifier) {
|
|||
modifier = modifier,
|
||||
textAlign = TextAlign.Start,
|
||||
color = TangemTheme.colors.text.tertiary,
|
||||
style = TangemTheme.typography.caption,
|
||||
style = TangemTheme.typography.caption2,
|
||||
)
|
||||
}
|
||||
is TransactionState.Loading -> {
|
||||
|
|
@ -304,7 +304,7 @@ private fun Timestamp(state: TransactionState, modifier: Modifier = Modifier) {
|
|||
modifier = modifier,
|
||||
textAlign = TextAlign.End,
|
||||
color = TangemTheme.colors.text.tertiary,
|
||||
style = TangemTheme.typography.caption,
|
||||
style = TangemTheme.typography.caption2,
|
||||
)
|
||||
}
|
||||
is TransactionState.Loading -> {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package com.tangem.core.ui.res
|
|||
import androidx.compose.material.Colors
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.ProvideTextStyle
|
||||
import androidx.compose.material.Typography
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.compose.runtime.ReadOnlyComposable
|
||||
|
|
@ -17,7 +16,7 @@ internal const val IS_SYSTEM_IN_DARK_THEME: Boolean = false
|
|||
@Composable
|
||||
fun TangemTheme(
|
||||
isDark: Boolean = false,
|
||||
typography: Typography = TangemTheme.typography,
|
||||
typography: TangemTypography = TangemTheme.typography,
|
||||
dimens: TangemDimens = TangemTheme.dimens,
|
||||
content: @Composable () -> Unit,
|
||||
) {
|
||||
|
|
@ -26,10 +25,8 @@ fun TangemTheme(
|
|||
.also { it.update(themeColors) }
|
||||
|
||||
val shapes = remember { TangemShapes(dimens) }
|
||||
|
||||
MaterialTheme(
|
||||
colors = materialThemeColors(colors = themeColors, isDark = isDark),
|
||||
typography = typography,
|
||||
) {
|
||||
CompositionLocalProvider(
|
||||
LocalTangemColors provides rememberedColors,
|
||||
|
|
@ -52,7 +49,7 @@ object TangemTheme {
|
|||
@ReadOnlyComposable
|
||||
get() = LocalTangemColors.current
|
||||
|
||||
val typography: Typography
|
||||
val typography: TangemTypography
|
||||
@Composable
|
||||
@ReadOnlyComposable
|
||||
get() = LocalTangemTypography.current
|
||||
|
|
@ -197,7 +194,7 @@ private val LocalTangemColors = staticCompositionLocalOf<TangemColors> {
|
|||
}
|
||||
|
||||
private val LocalTangemTypography = staticCompositionLocalOf {
|
||||
TangemTypography
|
||||
TangemTypography()
|
||||
}
|
||||
|
||||
private val LocalTangemDimens = staticCompositionLocalOf {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package com.tangem.core.ui.res
|
||||
|
||||
import androidx.compose.material.Typography
|
||||
import androidx.compose.runtime.Immutable
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.Font
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
|
|
@ -15,63 +15,87 @@ private val RobotoFamily = FontFamily(
|
|||
Font(R.font.roboto_medium, FontWeight.Medium),
|
||||
)
|
||||
|
||||
val TangemTypography = Typography(
|
||||
defaultFontFamily = RobotoFamily,
|
||||
h1 = TextStyle(
|
||||
@Immutable
|
||||
data class TangemTypography internal constructor(
|
||||
val head: TextStyle = TextStyle(
|
||||
fontFamily = RobotoFamily,
|
||||
fontSize = 34.sp,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
letterSpacing = TextUnit(value = 0f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 44f, type = TextUnitType.Sp),
|
||||
),
|
||||
val h1: TextStyle = TextStyle(
|
||||
fontFamily = RobotoFamily,
|
||||
fontSize = 34.sp,
|
||||
fontWeight = FontWeight.Normal,
|
||||
letterSpacing = TextUnit(value = 0f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 44f, type = TextUnitType.Sp),
|
||||
),
|
||||
h2 = TextStyle(
|
||||
val h2: TextStyle = TextStyle(
|
||||
fontFamily = RobotoFamily,
|
||||
fontSize = 24.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
letterSpacing = TextUnit(value = 0.18f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 32f, type = TextUnitType.Sp),
|
||||
),
|
||||
h3 = TextStyle(
|
||||
val h3: TextStyle = TextStyle(
|
||||
fontFamily = RobotoFamily,
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
letterSpacing = TextUnit(value = 0.15f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 24f, type = TextUnitType.Sp),
|
||||
),
|
||||
subtitle1 = TextStyle(
|
||||
val subtitle1: TextStyle = TextStyle(
|
||||
fontFamily = RobotoFamily,
|
||||
fontSize = 16.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
letterSpacing = TextUnit(value = 0.15f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 24f, type = TextUnitType.Sp),
|
||||
),
|
||||
subtitle2 = TextStyle(
|
||||
val subtitle2: TextStyle = TextStyle(
|
||||
fontFamily = RobotoFamily,
|
||||
fontSize = 14.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
letterSpacing = TextUnit(value = 0.5f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 24f, type = TextUnitType.Sp),
|
||||
),
|
||||
body1 = TextStyle(
|
||||
val body1: TextStyle = TextStyle(
|
||||
fontFamily = RobotoFamily,
|
||||
fontSize = 16.sp,
|
||||
fontWeight = FontWeight.Normal,
|
||||
letterSpacing = TextUnit(value = 0.5f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 24f, type = TextUnitType.Sp),
|
||||
),
|
||||
body2 = TextStyle(
|
||||
val body2: TextStyle = TextStyle(
|
||||
fontFamily = RobotoFamily,
|
||||
fontSize = 14.sp,
|
||||
fontWeight = FontWeight.Normal,
|
||||
letterSpacing = TextUnit(value = 0.25f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 20f, type = TextUnitType.Sp),
|
||||
),
|
||||
button = TextStyle(
|
||||
val button: TextStyle = TextStyle(
|
||||
fontFamily = RobotoFamily,
|
||||
fontSize = 14.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
letterSpacing = TextUnit(value = 0.1f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 16f, type = TextUnitType.Sp),
|
||||
),
|
||||
caption = TextStyle(
|
||||
val caption1: TextStyle = TextStyle(
|
||||
fontFamily = RobotoFamily,
|
||||
fontSize = 12.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
letterSpacing = TextUnit(value = 0.4f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 16f, type = TextUnitType.Sp),
|
||||
),
|
||||
val caption2: TextStyle = TextStyle(
|
||||
fontFamily = RobotoFamily,
|
||||
fontSize = 12.sp,
|
||||
fontWeight = FontWeight.Normal,
|
||||
letterSpacing = TextUnit(value = 0.4f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 16f, type = TextUnitType.Sp),
|
||||
),
|
||||
overline = TextStyle(
|
||||
val overline: TextStyle = TextStyle(
|
||||
fontFamily = RobotoFamily,
|
||||
fontSize = 10.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
letterSpacing = TextUnit(value = 1.5f, type = TextUnitType.Sp),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue