Updated on 2026-08-14
This commit is contained in:
parent
b02359feb6
commit
1feec554e6
6 changed files with 362 additions and 46 deletions
|
|
@ -13,6 +13,7 @@ import androidx.compose.ui.text.font.Font
|
|||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.font.FontStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.LineBreak
|
||||
import androidx.compose.ui.text.style.LineHeightStyle
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.TextUnit
|
||||
|
|
@ -26,6 +27,7 @@ internal val InterFamily = FontFamily(
|
|||
Font(R.font.inter_italic, style = FontStyle.Italic),
|
||||
)
|
||||
|
||||
@Suppress("LargeClass")
|
||||
@Stable
|
||||
class TangemTypography2 internal constructor(
|
||||
fontFamily: FontFamily,
|
||||
|
|
@ -40,157 +42,183 @@ class TangemTypography2 internal constructor(
|
|||
alignment = LineHeightStyle.Alignment.Center,
|
||||
trim = LineHeightStyle.Trim.None,
|
||||
),
|
||||
lineBreak = LineBreak.Heading,
|
||||
)
|
||||
|
||||
val headingRegular34: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 34.sp,
|
||||
fontWeight = FontWeight.Normal,
|
||||
letterSpacing = TextUnit(value = 0.37f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 40f, type = TextUnitType.Sp),
|
||||
letterSpacing = TextUnit(value = 0.4f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 44f, type = TextUnitType.Sp),
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
trim = LineHeightStyle.Trim.None,
|
||||
),
|
||||
lineBreak = LineBreak.Heading,
|
||||
)
|
||||
|
||||
val headingBold34: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 34.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
letterSpacing = TextUnit(value = 0.37f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 40f, type = TextUnitType.Sp),
|
||||
letterSpacing = TextUnit(value = 0.4f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 44f, type = TextUnitType.Sp),
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
trim = LineHeightStyle.Trim.None,
|
||||
),
|
||||
lineBreak = LineBreak.Heading,
|
||||
)
|
||||
|
||||
val headingRegular28: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 28.sp,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
letterSpacing = TextUnit(value = 0.36f, type = TextUnitType.Sp),
|
||||
fontWeight = FontWeight.Normal,
|
||||
letterSpacing = TextUnit(value = 0.38f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 36f, type = TextUnitType.Sp),
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
trim = LineHeightStyle.Trim.None,
|
||||
),
|
||||
lineBreak = LineBreak.Heading,
|
||||
)
|
||||
|
||||
val headingSemibold28: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 28.sp,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
letterSpacing = TextUnit(value = 0.38f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 36f, type = TextUnitType.Sp),
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
trim = LineHeightStyle.Trim.None,
|
||||
),
|
||||
lineBreak = LineBreak.Heading,
|
||||
)
|
||||
|
||||
val headingBold28: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 28.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
letterSpacing = TextUnit(value = 0.36f, type = TextUnitType.Sp),
|
||||
letterSpacing = TextUnit(value = 0.38f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 36f, type = TextUnitType.Sp),
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
trim = LineHeightStyle.Trim.None,
|
||||
),
|
||||
lineBreak = LineBreak.Heading,
|
||||
)
|
||||
|
||||
val headingRegular22: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 22.sp,
|
||||
fontWeight = FontWeight.Normal,
|
||||
letterSpacing = TextUnit(value = 0.35f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 28f, type = TextUnitType.Sp),
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
trim = LineHeightStyle.Trim.None,
|
||||
),
|
||||
)
|
||||
|
||||
val headingBold22: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 22.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
letterSpacing = TextUnit(value = 0.35f, type = TextUnitType.Sp),
|
||||
letterSpacing = TextUnit(value = -0.26f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 28f, type = TextUnitType.Sp),
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
trim = LineHeightStyle.Trim.None,
|
||||
),
|
||||
lineBreak = LineBreak.Heading,
|
||||
)
|
||||
|
||||
val headingSemibold22: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 22.sp,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
letterSpacing = TextUnit(value = 0.38f, type = TextUnitType.Sp),
|
||||
letterSpacing = TextUnit(value = -0.26f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 28f, type = TextUnitType.Sp),
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
trim = LineHeightStyle.Trim.None,
|
||||
),
|
||||
lineBreak = LineBreak.Heading,
|
||||
)
|
||||
|
||||
val headingBold22: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 22.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
letterSpacing = TextUnit(value = -0.26f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 28f, type = TextUnitType.Sp),
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
trim = LineHeightStyle.Trim.None,
|
||||
),
|
||||
lineBreak = LineBreak.Heading,
|
||||
)
|
||||
|
||||
val headingRegular20: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Normal,
|
||||
letterSpacing = TextUnit(value = 0.38f, type = TextUnitType.Sp),
|
||||
letterSpacing = TextUnit(value = -0.45f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 24f, type = TextUnitType.Sp),
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
trim = LineHeightStyle.Trim.None,
|
||||
),
|
||||
lineBreak = LineBreak.Heading,
|
||||
)
|
||||
|
||||
val headingSemibold20: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
letterSpacing = TextUnit(value = 0.38f, type = TextUnitType.Sp),
|
||||
letterSpacing = TextUnit(value = -1.2f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 24f, type = TextUnitType.Sp),
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
trim = LineHeightStyle.Trim.None,
|
||||
),
|
||||
lineBreak = LineBreak.Heading,
|
||||
)
|
||||
|
||||
val headingRegular17: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 17.sp,
|
||||
fontWeight = FontWeight.Normal,
|
||||
letterSpacing = TextUnit(value = -0.41f, type = TextUnitType.Sp),
|
||||
letterSpacing = TextUnit(value = -0.43f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 20f, type = TextUnitType.Sp),
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
trim = LineHeightStyle.Trim.None,
|
||||
),
|
||||
lineBreak = LineBreak.Heading,
|
||||
)
|
||||
|
||||
val headingMedium17: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 17.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
letterSpacing = TextUnit(value = -0.43f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 20f, type = TextUnitType.Sp),
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
trim = LineHeightStyle.Trim.None,
|
||||
),
|
||||
lineBreak = LineBreak.Heading,
|
||||
)
|
||||
|
||||
val headingSemibold17: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 17.sp,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
letterSpacing = TextUnit(value = -0.2f, type = TextUnitType.Sp),
|
||||
letterSpacing = TextUnit(value = -0.43f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 20f, type = TextUnitType.Sp),
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
trim = LineHeightStyle.Trim.None,
|
||||
),
|
||||
lineBreak = LineBreak.Heading,
|
||||
)
|
||||
|
||||
val bodyRegular16: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 16.sp,
|
||||
fontWeight = FontWeight.Normal,
|
||||
letterSpacing = TextUnit(value = -0.32f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 20f, type = TextUnitType.Sp),
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
trim = LineHeightStyle.Trim.None,
|
||||
),
|
||||
)
|
||||
|
||||
val bodySemibold16: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 16.sp,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
letterSpacing = TextUnit(value = -0.32f, type = TextUnitType.Sp),
|
||||
letterSpacing = TextUnit(value = -0.31f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 20f, type = TextUnitType.Sp),
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
|
|
@ -202,7 +230,7 @@ class TangemTypography2 internal constructor(
|
|||
fontFamily = fontFamily,
|
||||
fontSize = 16.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
letterSpacing = TextUnit(value = -0.32f, type = TextUnitType.Sp),
|
||||
letterSpacing = TextUnit(value = -0.31f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 20f, type = TextUnitType.Sp),
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
|
|
@ -210,6 +238,22 @@ class TangemTypography2 internal constructor(
|
|||
),
|
||||
)
|
||||
|
||||
val bodySemibold16: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 16.sp,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
letterSpacing = TextUnit(value = -0.31f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 20f, type = TextUnitType.Sp),
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
trim = LineHeightStyle.Trim.None,
|
||||
),
|
||||
)
|
||||
|
||||
@Deprecated(
|
||||
"will be removed",
|
||||
replaceWith = ReplaceWith("calloutRegular15"),
|
||||
)
|
||||
val bodyRegular15: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 15.sp,
|
||||
|
|
@ -222,6 +266,34 @@ class TangemTypography2 internal constructor(
|
|||
),
|
||||
)
|
||||
|
||||
val calloutRegular15: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 15.sp,
|
||||
fontWeight = FontWeight.Normal,
|
||||
letterSpacing = TextUnit(value = -0.23f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 16f, type = TextUnitType.Sp),
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
trim = LineHeightStyle.Trim.None,
|
||||
),
|
||||
)
|
||||
|
||||
val calloutSemibold15: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 15.sp,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
letterSpacing = TextUnit(value = -0.23f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 16f, type = TextUnitType.Sp),
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
trim = LineHeightStyle.Trim.None,
|
||||
),
|
||||
)
|
||||
|
||||
@Deprecated(
|
||||
message = "will be removed",
|
||||
replaceWith = ReplaceWith("calloutSemibold15"),
|
||||
)
|
||||
val bodySemibold15: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 15.sp,
|
||||
|
|
@ -234,6 +306,34 @@ class TangemTypography2 internal constructor(
|
|||
),
|
||||
)
|
||||
|
||||
val subheadlineRegular14: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 14.sp,
|
||||
fontWeight = FontWeight.Normal,
|
||||
letterSpacing = TextUnit(value = -0.15f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 16f, type = TextUnitType.Sp),
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
trim = LineHeightStyle.Trim.None,
|
||||
),
|
||||
)
|
||||
|
||||
val subheadlineMedium14: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 14.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
letterSpacing = TextUnit(value = -0.15f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 16f, type = TextUnitType.Sp),
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
trim = LineHeightStyle.Trim.None,
|
||||
),
|
||||
)
|
||||
|
||||
@Deprecated(
|
||||
"will be removed",
|
||||
replaceWith = ReplaceWith("subheadlineRegular14"),
|
||||
)
|
||||
val bodyRegular14: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 14.sp,
|
||||
|
|
@ -258,6 +358,10 @@ class TangemTypography2 internal constructor(
|
|||
),
|
||||
)
|
||||
|
||||
@Deprecated(
|
||||
message = "will be removed",
|
||||
replaceWith = ReplaceWith("captionMedium13"),
|
||||
)
|
||||
val captionSemibold13: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 13.sp,
|
||||
|
|
@ -270,6 +374,18 @@ class TangemTypography2 internal constructor(
|
|||
),
|
||||
)
|
||||
|
||||
val captionMedium13: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 13.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
letterSpacing = TextUnit(value = -0.08f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 16f, type = TextUnitType.Sp),
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
trim = LineHeightStyle.Trim.None,
|
||||
),
|
||||
)
|
||||
|
||||
val captionRegular12: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 12.sp,
|
||||
|
|
@ -282,6 +398,10 @@ class TangemTypography2 internal constructor(
|
|||
),
|
||||
)
|
||||
|
||||
@Deprecated(
|
||||
"will be removed",
|
||||
replaceWith = ReplaceWith("captionMedium12"),
|
||||
)
|
||||
val captionSemibold12: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 12.sp,
|
||||
|
|
@ -294,11 +414,23 @@ class TangemTypography2 internal constructor(
|
|||
),
|
||||
)
|
||||
|
||||
val captionMedium12: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 12.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
letterSpacing = TextUnit(value = 0.0f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 16f, type = TextUnitType.Sp),
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
trim = LineHeightStyle.Trim.None,
|
||||
),
|
||||
)
|
||||
|
||||
val captionRegular11: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 11.sp,
|
||||
fontWeight = FontWeight.Normal,
|
||||
letterSpacing = TextUnit(value = 0.07f, type = TextUnitType.Sp),
|
||||
letterSpacing = TextUnit(value = 0.06f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 12f, type = TextUnitType.Sp),
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
|
|
@ -306,6 +438,10 @@ class TangemTypography2 internal constructor(
|
|||
),
|
||||
)
|
||||
|
||||
@Deprecated(
|
||||
"will be removed",
|
||||
replaceWith = ReplaceWith("captionMedium11"),
|
||||
)
|
||||
val captionSemibold11: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 11.sp,
|
||||
|
|
@ -317,6 +453,18 @@ class TangemTypography2 internal constructor(
|
|||
trim = LineHeightStyle.Trim.None,
|
||||
),
|
||||
)
|
||||
|
||||
val captionMedium11: TextStyle = TextStyle(
|
||||
fontFamily = fontFamily,
|
||||
fontSize = 11.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
letterSpacing = TextUnit(value = 0.06f, type = TextUnitType.Sp),
|
||||
lineHeight = TextUnit(value = 12f, type = TextUnitType.Sp),
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
trim = LineHeightStyle.Trim.None,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
// region Preview
|
||||
|
|
@ -330,24 +478,29 @@ private fun TangemTypography2_Preview() {
|
|||
TangemTheme.typography2.headingRegular34,
|
||||
TangemTheme.typography2.headingBold34,
|
||||
TangemTheme.typography2.headingRegular28,
|
||||
TangemTheme.typography2.headingSemibold28,
|
||||
TangemTheme.typography2.headingBold28,
|
||||
TangemTheme.typography2.headingRegular22,
|
||||
TangemTheme.typography2.headingSemibold22,
|
||||
TangemTheme.typography2.headingBold22,
|
||||
TangemTheme.typography2.headingRegular20,
|
||||
TangemTheme.typography2.headingSemibold20,
|
||||
TangemTheme.typography2.headingRegular17,
|
||||
TangemTheme.typography2.headingMedium17,
|
||||
TangemTheme.typography2.headingSemibold17,
|
||||
TangemTheme.typography2.bodyRegular16,
|
||||
TangemTheme.typography2.bodyMedium16,
|
||||
TangemTheme.typography2.bodySemibold16,
|
||||
TangemTheme.typography2.bodyRegular15,
|
||||
TangemTheme.typography2.bodySemibold15,
|
||||
TangemTheme.typography2.bodyRegular14,
|
||||
TangemTheme.typography2.calloutRegular15,
|
||||
TangemTheme.typography2.calloutSemibold15,
|
||||
TangemTheme.typography2.subheadlineRegular14,
|
||||
TangemTheme.typography2.subheadlineMedium14,
|
||||
TangemTheme.typography2.captionRegular13,
|
||||
TangemTheme.typography2.captionSemibold13,
|
||||
TangemTheme.typography2.captionMedium13,
|
||||
TangemTheme.typography2.captionRegular12,
|
||||
TangemTheme.typography2.captionSemibold12,
|
||||
TangemTheme.typography2.captionMedium12,
|
||||
TangemTheme.typography2.captionRegular11,
|
||||
TangemTheme.typography2.captionSemibold11,
|
||||
TangemTheme.typography2.captionMedium11,
|
||||
)
|
||||
|
||||
Column(
|
||||
|
|
|
|||
|
|
@ -59,4 +59,9 @@ internal data class TangemHeaderRowStory(
|
|||
internal data class TangemSearchFieldStory(
|
||||
val selectedShape: TangemFieldShape,
|
||||
val onShapeChange: (TangemFieldShape) -> Unit,
|
||||
) : StoryBookPage
|
||||
|
||||
internal data class TypographyStory(
|
||||
val isFontScaleDefault: Boolean,
|
||||
val onFontScaleToggle: () -> Unit,
|
||||
) : StoryBookPage
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.tangem.feature.tester.presentation.storybook.page.typography
|
||||
|
||||
import com.tangem.feature.tester.presentation.storybook.entity.TypographyStory
|
||||
import com.tangem.feature.tester.presentation.storybook.viewmodel.StateUpdater
|
||||
import com.tangem.feature.tester.presentation.storybook.viewmodel.storyPageFactory
|
||||
|
||||
internal fun StateUpdater<TypographyStory>.build(): TypographyStory {
|
||||
return TypographyStory(
|
||||
isFontScaleDefault = false,
|
||||
onFontScaleToggle = { updateStory { it.copy(isFontScaleDefault = !it.isFontScaleDefault) } },
|
||||
)
|
||||
}
|
||||
|
||||
internal val typographyStoryFactory
|
||||
get() = storyPageFactory(StateUpdater<TypographyStory>::build)
|
||||
|
|
@ -0,0 +1,138 @@
|
|||
package com.tangem.feature.tester.presentation.storybook.page.typography
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.statusBarsPadding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.itemsIndexed
|
||||
import androidx.compose.material3.Switch
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.Density
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.feature.tester.presentation.storybook.entity.TypographyStory as TypographyStoryState
|
||||
|
||||
private data class TypographyItem(val name: String, val style: TextStyle)
|
||||
|
||||
@Composable
|
||||
internal fun TypographyStory(state: TypographyStoryState, modifier: Modifier = Modifier) {
|
||||
if (state.isFontScaleDefault) {
|
||||
val density = LocalDensity.current
|
||||
val overriddenDensity = remember(density) {
|
||||
Density(density = density.density, fontScale = 1f)
|
||||
}
|
||||
CompositionLocalProvider(LocalDensity provides overriddenDensity) {
|
||||
TypographyContent(state = state, modifier = modifier)
|
||||
}
|
||||
} else {
|
||||
TypographyContent(state = state, modifier = modifier)
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("LongMethod", "ModifierHeightWithText")
|
||||
@Composable
|
||||
private fun TypographyContent(state: TypographyStoryState, modifier: Modifier = Modifier) {
|
||||
val typography2 = TangemTheme.typography2
|
||||
val items = remember(typography2) {
|
||||
listOf(
|
||||
TypographyItem("titleRegular44", typography2.titleRegular44),
|
||||
TypographyItem("headingRegular34", typography2.headingRegular34),
|
||||
TypographyItem("headingBold34", typography2.headingBold34),
|
||||
TypographyItem("headingRegular28", typography2.headingRegular28),
|
||||
TypographyItem("headingSemibold28", typography2.headingSemibold28),
|
||||
TypographyItem("headingBold28", typography2.headingBold28),
|
||||
TypographyItem("headingRegular22", typography2.headingRegular22),
|
||||
TypographyItem("headingSemibold22", typography2.headingSemibold22),
|
||||
TypographyItem("headingBold22", typography2.headingBold22),
|
||||
TypographyItem("headingRegular20", typography2.headingRegular20),
|
||||
TypographyItem("headingSemibold20", typography2.headingSemibold20),
|
||||
TypographyItem("headingRegular17", typography2.headingRegular17),
|
||||
TypographyItem("headingMedium17", typography2.headingMedium17),
|
||||
TypographyItem("headingSemibold17", typography2.headingSemibold17),
|
||||
TypographyItem("bodyRegular16", typography2.bodyRegular16),
|
||||
TypographyItem("bodyMedium16", typography2.bodyMedium16),
|
||||
TypographyItem("bodySemibold16", typography2.bodySemibold16),
|
||||
TypographyItem("calloutRegular15", typography2.calloutRegular15),
|
||||
TypographyItem("calloutSemibold15", typography2.calloutSemibold15),
|
||||
TypographyItem("subheadlineRegular14", typography2.subheadlineRegular14),
|
||||
TypographyItem("subheadlineMedium14", typography2.subheadlineMedium14),
|
||||
TypographyItem("captionRegular13", typography2.captionRegular13),
|
||||
TypographyItem("captionMedium13", typography2.captionMedium13),
|
||||
TypographyItem("captionRegular12", typography2.captionRegular12),
|
||||
TypographyItem("captionMedium12", typography2.captionMedium12),
|
||||
TypographyItem("captionRegular11", typography2.captionRegular11),
|
||||
TypographyItem("captionMedium11", typography2.captionMedium11),
|
||||
)
|
||||
}
|
||||
|
||||
LazyColumn(
|
||||
verticalArrangement = Arrangement.spacedBy(32.dp),
|
||||
modifier = modifier
|
||||
.statusBarsPadding()
|
||||
.navigationBarsPadding()
|
||||
.padding(top = 48.dp)
|
||||
.fillMaxSize()
|
||||
.background(TangemTheme.colors2.surface.level1),
|
||||
) {
|
||||
item(key = "toggle") {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
) {
|
||||
Text(
|
||||
text = "Force fontScale = 1.0",
|
||||
style = TangemTheme.typography2.bodyMedium16,
|
||||
color = TangemTheme.colors2.text.neutral.primary,
|
||||
)
|
||||
Switch(
|
||||
checked = state.isFontScaleDefault,
|
||||
onCheckedChange = { state.onFontScaleToggle() },
|
||||
)
|
||||
}
|
||||
}
|
||||
itemsIndexed(items = items, key = { _, item -> item.name }) { index, item ->
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.border(width = 1.dp, color = TangemTheme.colors2.surface.level2)
|
||||
.height(if (index == 0) 48.dp else 44.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
) {
|
||||
Text(
|
||||
text = "Lorem ipsum",
|
||||
style = item.style,
|
||||
color = TangemTheme.colors2.text.neutral.primary,
|
||||
modifier = Modifier.padding(horizontal = 16.dp),
|
||||
)
|
||||
|
||||
Text(
|
||||
text = item.name,
|
||||
style = TangemTheme.typography2.captionRegular12,
|
||||
color = TangemTheme.colors2.text.neutral.tertiary,
|
||||
textAlign = TextAlign.End,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -26,6 +26,7 @@ import com.tangem.feature.tester.presentation.storybook.page.opportunities.oppor
|
|||
import com.tangem.feature.tester.presentation.storybook.page.searchfield.tangemSearchFieldStoryFactory
|
||||
import com.tangem.feature.tester.presentation.storybook.page.tabs.tangemSegmentedPickerStoryFactory
|
||||
import com.tangem.feature.tester.presentation.storybook.page.tokenrow.tangemTokenRowStoryFactory
|
||||
import com.tangem.feature.tester.presentation.storybook.page.typography.typographyStoryFactory
|
||||
|
||||
private data class StoryItem(val title: String, val factory: StoryPageFactory)
|
||||
|
||||
|
|
@ -41,6 +42,7 @@ private fun buildStories() = listOf(
|
|||
StoryItem(title = "📑 Header Row", factory = tangemHeaderRowStoryFactory),
|
||||
StoryItem(title = "📋 Context Menu", factory = tangemContextMenuStoryFactory),
|
||||
StoryItem(title = "🔍 Search Field", factory = tangemSearchFieldStoryFactory),
|
||||
StoryItem(title = "🔤 Typography", factory = typographyStoryFactory),
|
||||
)
|
||||
|
||||
@Composable
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import com.tangem.feature.tester.presentation.storybook.entity.TangemMessageStor
|
|||
import com.tangem.feature.tester.presentation.storybook.entity.TangemSearchFieldStory
|
||||
import com.tangem.feature.tester.presentation.storybook.entity.TangemSegmentedPickerStory
|
||||
import com.tangem.feature.tester.presentation.storybook.entity.TangemTokenRowStory
|
||||
import com.tangem.feature.tester.presentation.storybook.entity.TypographyStory
|
||||
import com.tangem.feature.tester.presentation.storybook.page.background.NorthernLightsStory
|
||||
import com.tangem.feature.tester.presentation.storybook.page.badge.TangemBadgeStory
|
||||
import com.tangem.feature.tester.presentation.storybook.page.buttons.ButtonsStory
|
||||
|
|
@ -28,6 +29,7 @@ import com.tangem.feature.tester.presentation.storybook.page.tokenrow.TangemToke
|
|||
import com.tangem.feature.tester.presentation.storybook.page.headerrow.TangemHeaderRowStory
|
||||
import com.tangem.feature.tester.presentation.storybook.page.contextmenu.TangemContextMenuStory
|
||||
import com.tangem.feature.tester.presentation.storybook.page.searchfield.TangemSearchFieldStory
|
||||
import com.tangem.feature.tester.presentation.storybook.page.typography.TypographyStory
|
||||
|
||||
@Composable
|
||||
internal fun StoryBookScreen(state: StoryBookUM, modifier: Modifier = Modifier) {
|
||||
|
|
@ -51,6 +53,7 @@ internal fun StoryBookScreen(state: StoryBookUM, modifier: Modifier = Modifier)
|
|||
is TangemHeaderRowStory -> TangemHeaderRowStory(state = storyState)
|
||||
is TangemContextMenuStory -> TangemContextMenuStory(state = storyState)
|
||||
is TangemSearchFieldStory -> TangemSearchFieldStory(state = storyState)
|
||||
is TypographyStory -> TypographyStory(state = storyState)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue