Updated on 2026-08-14
This commit is contained in:
parent
b96f007568
commit
fa7a381e04
131 changed files with 736 additions and 1778 deletions
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
|
|
@ -12,6 +13,7 @@ import androidx.compose.ui.graphics.Shape
|
|||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.tangem.core.ui.R
|
||||
import com.tangem.core.ui.components.buttons.common.*
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
|
||||
// region TextButton
|
||||
|
|
@ -319,17 +321,10 @@ private fun PrimaryButtonSample() {
|
|||
}
|
||||
|
||||
@Preview(showBackground = true, widthDp = 360)
|
||||
@Preview(showBackground = true, widthDp = 360, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun PrimaryButtonPreview_Light() {
|
||||
TangemTheme {
|
||||
PrimaryButtonSample()
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true, widthDp = 360)
|
||||
@Composable
|
||||
private fun PrimaryButtonPreview_Dark() {
|
||||
TangemTheme(isDark = true) {
|
||||
private fun PrimaryButtonPreview() {
|
||||
TangemThemePreview {
|
||||
PrimaryButtonSample()
|
||||
}
|
||||
}
|
||||
|
|
@ -383,17 +378,10 @@ private fun SecondaryButtonSample() {
|
|||
}
|
||||
|
||||
@Preview(showBackground = true, widthDp = 360)
|
||||
@Preview(showBackground = true, widthDp = 360, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun SecondaryButtonPreview_Light() {
|
||||
TangemTheme {
|
||||
SecondaryButtonSample()
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true, widthDp = 360)
|
||||
@Composable
|
||||
private fun SecondaryButtonPreview_Dark() {
|
||||
TangemTheme(isDark = true) {
|
||||
private fun SecondaryButtonPreview() {
|
||||
TangemThemePreview {
|
||||
SecondaryButtonSample()
|
||||
}
|
||||
}
|
||||
|
|
@ -414,19 +402,11 @@ private fun TextButtonSample() {
|
|||
}
|
||||
|
||||
@Preview(showBackground = true, widthDp = 360)
|
||||
@Preview(showBackground = true, widthDp = 360, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun TextButtonPreview_LightTheme() {
|
||||
TangemTheme {
|
||||
private fun TextButtonPreview() {
|
||||
TangemThemePreview {
|
||||
TextButtonSample()
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true, widthDp = 360)
|
||||
@Composable
|
||||
private fun TextButtonPreview_DarkTheme() {
|
||||
TangemTheme(isDark = true) {
|
||||
TextButtonSample()
|
||||
}
|
||||
}
|
||||
|
||||
// endregion Preview
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.compose.foundation.layout.RowScope
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
|
|
@ -16,15 +17,17 @@ import androidx.compose.ui.res.painterResource
|
|||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.tangem.core.ui.R
|
||||
import com.tangem.core.ui.res.ButtonColorType
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TextColorType
|
||||
import com.tangem.core.ui.res.buttonColor
|
||||
import com.tangem.core.ui.res.textColor
|
||||
|
||||
@Preview(widthDp = 328, heightDp = 48, showBackground = true)
|
||||
@Preview(widthDp = 328, heightDp = 48, showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun Preview_PrimaryStartIconButton_Enabled_InLightTheme() {
|
||||
TangemTheme(isDark = false) {
|
||||
private fun Preview_PrimaryStartIconButton_Enabled() {
|
||||
TangemThemePreview {
|
||||
PrimaryStartIconButton(
|
||||
text = "Manage tokens",
|
||||
iconResId = R.drawable.ic_tangem_24,
|
||||
|
|
@ -35,22 +38,10 @@ private fun Preview_PrimaryStartIconButton_Enabled_InLightTheme() {
|
|||
}
|
||||
|
||||
@Preview(widthDp = 328, heightDp = 48, showBackground = true)
|
||||
@Preview(widthDp = 328, heightDp = 48, showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun Preview_PrimaryStartIconButton_Enabled_InDarkTheme() {
|
||||
TangemTheme(isDark = true) {
|
||||
PrimaryStartIconButton(
|
||||
text = "Manage tokens",
|
||||
iconResId = R.drawable.ic_tangem_24,
|
||||
enabled = true,
|
||||
onClick = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(widthDp = 328, heightDp = 48, showBackground = true)
|
||||
@Composable
|
||||
private fun Preview_PrimaryStartIconButton_Disabled_InLightTheme() {
|
||||
TangemTheme(isDark = false) {
|
||||
private fun Preview_PrimaryStartIconButton_Disabled() {
|
||||
TangemThemePreview {
|
||||
PrimaryStartIconButton(
|
||||
text = "Manage tokens",
|
||||
iconResId = R.drawable.ic_tangem_24,
|
||||
|
|
@ -61,22 +52,10 @@ private fun Preview_PrimaryStartIconButton_Disabled_InLightTheme() {
|
|||
}
|
||||
|
||||
@Preview(widthDp = 328, heightDp = 48, showBackground = true)
|
||||
@Preview(widthDp = 328, heightDp = 48, showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun Preview_PrimaryStartIconButton_Disabled_InDarkTheme() {
|
||||
TangemTheme(isDark = true) {
|
||||
PrimaryStartIconButton(
|
||||
text = "Manage tokens",
|
||||
iconResId = R.drawable.ic_tangem_24,
|
||||
enabled = false,
|
||||
onClick = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(widthDp = 328, heightDp = 48, showBackground = true)
|
||||
@Composable
|
||||
private fun Preview_PrimaryEndIconButton_Enabled_InLightTheme() {
|
||||
TangemTheme(isDark = false) {
|
||||
private fun Preview_PrimaryEndIconButton_Enabled() {
|
||||
TangemThemePreview {
|
||||
PrimaryEndIconButton(
|
||||
text = "Manage tokens",
|
||||
iconResId = R.drawable.ic_tangem_24,
|
||||
|
|
@ -87,35 +66,10 @@ private fun Preview_PrimaryEndIconButton_Enabled_InLightTheme() {
|
|||
}
|
||||
|
||||
@Preview(widthDp = 328, heightDp = 48, showBackground = true)
|
||||
@Preview(widthDp = 328, heightDp = 48, showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun Preview_PrimaryEndIconButton_Enabled_InDarkTheme() {
|
||||
TangemTheme(isDark = true) {
|
||||
PrimaryEndIconButton(
|
||||
text = "Manage tokens",
|
||||
iconResId = R.drawable.ic_tangem_24,
|
||||
enabled = true,
|
||||
onClick = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(widthDp = 328, heightDp = 48, showBackground = true)
|
||||
@Composable
|
||||
private fun Preview_PrimaryEndIconButton_Disabled_InLightTheme() {
|
||||
TangemTheme(isDark = false) {
|
||||
PrimaryEndIconButton(
|
||||
text = "Manage tokens",
|
||||
iconResId = R.drawable.ic_tangem_24,
|
||||
enabled = false,
|
||||
onClick = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(widthDp = 328, heightDp = 48, showBackground = true)
|
||||
@Composable
|
||||
private fun Preview_PrimaryEndIconButton_Disabled_InDarkTheme() {
|
||||
TangemTheme(isDark = true) {
|
||||
private fun Preview_PrimaryEndIconButton_Disabled() {
|
||||
TangemThemePreview {
|
||||
PrimaryEndIconButton(
|
||||
text = "Manage tokens",
|
||||
iconResId = R.drawable.ic_tangem_24,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
|
|
@ -22,6 +23,7 @@ import com.tangem.core.ui.components.states.Item
|
|||
import com.tangem.core.ui.components.states.SelectableItemsState
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.core.ui.extensions.resolveReference
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.valentinilk.shimmer.shimmer
|
||||
import kotlinx.collections.immutable.toImmutableList
|
||||
|
|
@ -650,34 +652,19 @@ private fun CardsPreview() {
|
|||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Preview(showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun Preview_Cards_InLightTheme() {
|
||||
TangemTheme(isDark = false) {
|
||||
CardsPreview()
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun Preview_InfoCardWithWarning_InDarkTheme() {
|
||||
TangemTheme(isDark = true) {
|
||||
private fun Preview_Cards() {
|
||||
TangemThemePreview {
|
||||
CardsPreview()
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(widthDp = 328, heightDp = 48, showBackground = true)
|
||||
@Preview(widthDp = 328, heightDp = 48, showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun Preview_SimpleInfoCard_InLightTheme() {
|
||||
TangemTheme(isDark = false) {
|
||||
SmallInfoCard(startText = "Balance", endText = "0.4405434 BTC")
|
||||
SmallInfoCardWithDisclaimer(startText = "Balance", endText = "0.4405434 BTC", disclaimer = "test")
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(widthDp = 328, heightDp = 48, showBackground = true)
|
||||
@Composable
|
||||
private fun Preview_SimpleInfoCard_InDarkTheme() {
|
||||
TangemTheme(isDark = true) {
|
||||
private fun Preview_SimpleInfoCard() {
|
||||
TangemThemePreview {
|
||||
SmallInfoCard(startText = "Balance", endText = "0.4405434 BTC")
|
||||
SmallInfoCardWithDisclaimer(startText = "Balance", endText = "0.4405434 BTC", disclaimer = "test")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.padding
|
||||
|
|
@ -11,6 +12,7 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
|
||||
/**
|
||||
|
|
@ -39,19 +41,11 @@ fun CurrencyPlaceholderIcon(id: String, modifier: Modifier = Modifier) {
|
|||
// region preview
|
||||
|
||||
@Preview(showBackground = true, heightDp = 40, widthDp = 40)
|
||||
@Preview(showBackground = true, heightDp = 40, widthDp = 40, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun Preview_CurrencyPlaceholderIcon_InLightTheme() {
|
||||
TangemTheme(isDark = false) {
|
||||
private fun Preview_CurrencyPlaceholderIcon() {
|
||||
TangemThemePreview {
|
||||
CurrencyPlaceholderIcon(id = "DAI")
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true, heightDp = 40, widthDp = 40)
|
||||
@Composable
|
||||
private fun Preview_CurrencyPlaceholderIcon_InDarkTheme() {
|
||||
TangemTheme(isDark = true) {
|
||||
CurrencyPlaceholderIcon(id = "DAI")
|
||||
}
|
||||
}
|
||||
|
||||
// endregion preview
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.LocalIndication
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
|
|
@ -26,6 +27,7 @@ import com.tangem.core.ui.R
|
|||
import com.tangem.core.ui.components.SelctorDialogParamsProvider.SelectorDialogParams
|
||||
import com.tangem.core.ui.components.buttons.common.TangemButtonsDefaults
|
||||
import com.tangem.core.ui.components.fields.SimpleDialogTextField
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
|
|
@ -450,33 +452,19 @@ private fun BasicDialogPreview() {
|
|||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Preview(showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun Preview_SimpleOkDialog_InLightTheme() {
|
||||
TangemTheme(isDark = false) {
|
||||
private fun Preview_SimpleOkDialog() {
|
||||
TangemThemePreview {
|
||||
SimpleOkDialogPreview()
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Preview(showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun Preview_BasicDialog_InLightTheme() {
|
||||
TangemTheme(isDark = false) {
|
||||
BasicDialogPreview()
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun Preview_SimpleOkDialog_InDarkTheme() {
|
||||
TangemTheme(isDark = true) {
|
||||
SimpleOkDialogPreview()
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun Preview_BasicDialog_InDarkTheme() {
|
||||
TangemTheme(isDark = true) {
|
||||
private fun Preview_BasicDialog() {
|
||||
TangemThemePreview {
|
||||
BasicDialogPreview()
|
||||
}
|
||||
}
|
||||
|
|
@ -498,17 +486,10 @@ private fun WarningBasicDialogSample(modifier: Modifier = Modifier) {
|
|||
}
|
||||
|
||||
@Preview(showBackground = true, widthDp = 360)
|
||||
@Preview(showBackground = true, widthDp = 360, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun WarningBasicDialogPreview_Light() {
|
||||
TangemTheme {
|
||||
WarningBasicDialogSample()
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true, widthDp = 360)
|
||||
@Composable
|
||||
private fun WarningBasicDialogPreview_Dark() {
|
||||
TangemTheme(isDark = true) {
|
||||
private fun WarningBasicDialogPreview() {
|
||||
TangemThemePreview {
|
||||
WarningBasicDialogSample()
|
||||
}
|
||||
}
|
||||
|
|
@ -532,44 +513,19 @@ private fun TextInputDialogSample(modifier: Modifier = Modifier) {
|
|||
}
|
||||
|
||||
@Preview(showBackground = true, widthDp = 360)
|
||||
@Preview(showBackground = true, widthDp = 360, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun TextInputDialogPreview_Light() {
|
||||
TangemTheme {
|
||||
private fun TextInputDialogPreview() {
|
||||
TangemThemePreview {
|
||||
TextInputDialogSample()
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true, widthDp = 360)
|
||||
@Preview(showBackground = true, widthDp = 360, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun TextInputDialogPreview_Dark() {
|
||||
TangemTheme(isDark = true) {
|
||||
TextInputDialogSample()
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true, widthDp = 360)
|
||||
@Composable
|
||||
private fun SelectorDialogPreview_Light(
|
||||
@PreviewParameter(SelctorDialogParamsProvider::class) param: SelectorDialogParams,
|
||||
) {
|
||||
TangemTheme(isDark = false) {
|
||||
SelectorDialog(
|
||||
title = param.title,
|
||||
items = param.items,
|
||||
selectedItemIndex = param.selectedItemIndex,
|
||||
confirmButton = DialogButton(title = "Cancel", onClick = {}),
|
||||
onSelect = {},
|
||||
onDismissDialog = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true, widthDp = 360)
|
||||
@Composable
|
||||
private fun SelectorDialogPreview_Dark(
|
||||
@PreviewParameter(SelctorDialogParamsProvider::class) param: SelectorDialogParams,
|
||||
) {
|
||||
TangemTheme(isDark = true) {
|
||||
private fun SelectorDialogPreview(@PreviewParameter(SelctorDialogParamsProvider::class) param: SelectorDialogParams) {
|
||||
TangemThemePreview {
|
||||
SelectorDialog(
|
||||
title = param.title,
|
||||
items = param.items,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.heightIn
|
||||
|
|
@ -13,6 +14,7 @@ import androidx.compose.ui.tooling.preview.Preview
|
|||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
|
||||
/**
|
||||
* [Show in Figma](https://www.figma.com/file/14ISV23YB1yVW1uNVwqrKv/Android?type=design&node-id=68%3A20&mode=design&t=WSV3AxC6zV1y0CHF-1)
|
||||
|
|
@ -44,17 +46,10 @@ fun Notifier(
|
|||
}
|
||||
|
||||
@Preview
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun TangemNotifierPreview_Light(@PreviewParameter(NotifierProvider::class) text: String) {
|
||||
TangemTheme(isDark = false) {
|
||||
Notifier(text = text)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun TangemNotifierPreview_Dark(@PreviewParameter(NotifierProvider::class) text: String) {
|
||||
TangemTheme(isDark = true) {
|
||||
private fun TangemNotifierPreview(@PreviewParameter(NotifierProvider::class) text: String) {
|
||||
TangemThemePreview {
|
||||
Notifier(text = text)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.animation.core.LinearEasing
|
||||
import androidx.compose.animation.core.RepeatMode
|
||||
import androidx.compose.animation.core.infiniteRepeatable
|
||||
|
|
@ -18,6 +19,7 @@ import androidx.compose.ui.tooling.preview.Preview
|
|||
import androidx.compose.ui.unit.Dp
|
||||
import com.tangem.core.ui.res.LocalIsInDarkTheme
|
||||
import com.tangem.core.ui.res.TangemColorPalette
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.valentinilk.shimmer.*
|
||||
|
||||
|
|
@ -90,37 +92,24 @@ private val TangemShimmerColors: List<Color>
|
|||
|
||||
// region preview
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Preview(showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun ShimmersPreview() {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.background(TangemTheme.colors.background.primary),
|
||||
verticalArrangement = Arrangement.spacedBy(TangemTheme.dimens.spacing18),
|
||||
) {
|
||||
RectangleShimmer(
|
||||
TangemThemePreview {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(TangemTheme.dimens.size24),
|
||||
)
|
||||
CircleShimmer(modifier = Modifier.size(size = TangemTheme.dimens.size42))
|
||||
.background(TangemTheme.colors.background.primary),
|
||||
verticalArrangement = Arrangement.spacedBy(TangemTheme.dimens.spacing18),
|
||||
) {
|
||||
RectangleShimmer(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(TangemTheme.dimens.size24),
|
||||
)
|
||||
CircleShimmer(modifier = Modifier.size(size = TangemTheme.dimens.size42))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun Shimmers_InLightTheme() {
|
||||
TangemTheme(isDark = false) {
|
||||
ShimmersPreview()
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun Shimmers_InDarkTheme() {
|
||||
TangemTheme(isDark = true) {
|
||||
ShimmersPreview()
|
||||
}
|
||||
}
|
||||
|
||||
// endregion preview
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.animateColorAsState
|
||||
|
|
@ -25,6 +26,7 @@ import androidx.compose.ui.tooling.preview.Preview
|
|||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.tangem.core.ui.R
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
|
||||
/**
|
||||
|
|
@ -505,17 +507,10 @@ private fun OutlineTextFieldSample(modifier: Modifier = Modifier) {
|
|||
}
|
||||
|
||||
@Preview(showBackground = true, widthDp = 360)
|
||||
@Preview(showBackground = true, widthDp = 360, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun OutlineTextFieldPreview_Light() {
|
||||
TangemTheme {
|
||||
OutlineTextFieldSample()
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true, widthDp = 360)
|
||||
@Composable
|
||||
private fun OutlineTextFieldPreview_Dark() {
|
||||
TangemTheme(isDark = true) {
|
||||
private fun OutlineTextFieldPreview() {
|
||||
TangemThemePreview {
|
||||
OutlineTextFieldSample()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
|
|
@ -13,6 +14,7 @@ import androidx.compose.ui.graphics.Color
|
|||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.tangem.core.ui.R
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
|
||||
/**
|
||||
|
|
@ -179,42 +181,29 @@ private fun WarningCardMaterial3Style(onClick: (() -> Unit)? = null, content: @C
|
|||
|
||||
// region Preview
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Preview(showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun WarningsPreview() {
|
||||
Column(modifier = Modifier.fillMaxWidth()) {
|
||||
WarningCard(
|
||||
title = "Exchange rate has expired",
|
||||
description = "To access all the networks, you need to scan the card.",
|
||||
)
|
||||
SpacerH32()
|
||||
ClickableWarningCard(
|
||||
title = "Exchange rate has expired",
|
||||
description = "To access all the networks, you need to scan the card.",
|
||||
onClick = {},
|
||||
)
|
||||
SpacerH32()
|
||||
RefreshableWarningCard(
|
||||
title = "Exchange rate has expired",
|
||||
description = "To access all the networks, you need to scan the card.",
|
||||
onClick = {},
|
||||
)
|
||||
TangemThemePreview {
|
||||
Column(modifier = Modifier.fillMaxWidth()) {
|
||||
WarningCard(
|
||||
title = "Exchange rate has expired",
|
||||
description = "To access all the networks, you need to scan the card.",
|
||||
)
|
||||
SpacerH32()
|
||||
ClickableWarningCard(
|
||||
title = "Exchange rate has expired",
|
||||
description = "To access all the networks, you need to scan the card.",
|
||||
onClick = {},
|
||||
)
|
||||
SpacerH32()
|
||||
RefreshableWarningCard(
|
||||
title = "Exchange rate has expired",
|
||||
description = "To access all the networks, you need to scan the card.",
|
||||
onClick = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun Preview_Warning_InLightTheme() {
|
||||
TangemTheme(isDark = false) {
|
||||
WarningsPreview()
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun Preview_Warning_InDarkTheme() {
|
||||
TangemTheme(isDark = true) {
|
||||
WarningsPreview()
|
||||
}
|
||||
}
|
||||
|
||||
// endregion Preview
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.appbar
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.heightIn
|
||||
|
|
@ -15,6 +16,7 @@ import androidx.compose.ui.res.painterResource
|
|||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.tangem.core.ui.R
|
||||
import com.tangem.core.ui.components.appbar.models.AdditionalButton
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
|
||||
/**
|
||||
|
|
@ -71,9 +73,10 @@ fun AppBarWithAdditionalButtons(
|
|||
}
|
||||
|
||||
@Preview(widthDp = 360, heightDp = 56, showBackground = true)
|
||||
@Preview(widthDp = 360, heightDp = 56, showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun Preview_AppBarWithAdditionalButtons_InLightTheme() {
|
||||
TangemTheme(isDark = false) {
|
||||
private fun Preview_AppBarWithAdditionalButtons() {
|
||||
TangemThemePreview {
|
||||
AppBarWithAdditionalButtons(
|
||||
text = "Tangem",
|
||||
startButton = AdditionalButton(
|
||||
|
|
@ -89,27 +92,10 @@ private fun Preview_AppBarWithAdditionalButtons_InLightTheme() {
|
|||
}
|
||||
|
||||
@Preview(widthDp = 360, heightDp = 56, showBackground = true)
|
||||
@Preview(widthDp = 360, heightDp = 56, showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun Preview_AppBarWithAdditionalButtons_InDarkTheme() {
|
||||
TangemTheme(isDark = true) {
|
||||
AppBarWithAdditionalButtons(
|
||||
text = "Tangem",
|
||||
startButton = AdditionalButton(
|
||||
iconRes = R.drawable.ic_scan_24,
|
||||
onIconClicked = {},
|
||||
),
|
||||
endButton = AdditionalButton(
|
||||
iconRes = R.drawable.ic_more_vertical_24,
|
||||
onIconClicked = {},
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(widthDp = 360, heightDp = 56, showBackground = true)
|
||||
@Composable
|
||||
private fun Preview_AppBarWithOnlyStartButtons_InLightTheme() {
|
||||
TangemTheme(isDark = false) {
|
||||
private fun Preview_AppBarWithOnlyStartButtons() {
|
||||
TangemThemePreview {
|
||||
AppBarWithAdditionalButtons(
|
||||
text = "Tangem",
|
||||
startButton = AdditionalButton(
|
||||
|
|
@ -121,37 +107,10 @@ private fun Preview_AppBarWithOnlyStartButtons_InLightTheme() {
|
|||
}
|
||||
|
||||
@Preview(widthDp = 360, heightDp = 56, showBackground = true)
|
||||
@Preview(widthDp = 360, heightDp = 56, showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun Preview_AppBarWithOnlyStartButtons_InDarkTheme() {
|
||||
TangemTheme(isDark = true) {
|
||||
AppBarWithAdditionalButtons(
|
||||
text = "Tangem",
|
||||
startButton = AdditionalButton(
|
||||
iconRes = R.drawable.ic_scan_24,
|
||||
onIconClicked = {},
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(widthDp = 360, heightDp = 56, showBackground = true)
|
||||
@Composable
|
||||
private fun Preview_AppBarWithOnlyEndButtons_InLightTheme() {
|
||||
TangemTheme(isDark = false) {
|
||||
AppBarWithAdditionalButtons(
|
||||
text = "Tangem",
|
||||
endButton = AdditionalButton(
|
||||
iconRes = R.drawable.ic_more_vertical_24,
|
||||
onIconClicked = {},
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(widthDp = 360, heightDp = 56, showBackground = true)
|
||||
@Composable
|
||||
private fun Preview_AppBarWithOnlyEndButtons_InDarkTheme() {
|
||||
TangemTheme(isDark = true) {
|
||||
private fun Preview_AppBarWithOnlyEndButtons() {
|
||||
TangemThemePreview {
|
||||
AppBarWithAdditionalButtons(
|
||||
text = "Tangem",
|
||||
endButton = AdditionalButton(
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.appbar
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
|
|
@ -15,6 +16,7 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.tangem.core.ui.R
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
|
||||
/**
|
||||
|
|
@ -67,17 +69,10 @@ fun AppBarWithBackButton(
|
|||
}
|
||||
|
||||
@Preview(widthDp = 360, heightDp = 56, showBackground = true)
|
||||
@Preview(widthDp = 360, heightDp = 56, showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun PreviewAppBarWithBackButtonInLightTheme() {
|
||||
TangemTheme(isDark = false) {
|
||||
AppBarWithBackButton(text = "Title", onBackClick = {})
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(widthDp = 360, heightDp = 56, showBackground = true)
|
||||
@Composable
|
||||
private fun PreviewAppBarWithBackButtonInDarkTheme() {
|
||||
TangemTheme(isDark = true) {
|
||||
private fun PreviewAppBarWithBackButton() {
|
||||
TangemThemePreview {
|
||||
AppBarWithBackButton(text = "Title", onBackClick = {})
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.appbar
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.compose.animation.*
|
||||
import androidx.compose.foundation.clickable
|
||||
|
|
@ -11,6 +12,7 @@ import androidx.compose.ui.graphics.Color
|
|||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.tangem.core.ui.R
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
|
||||
@Composable
|
||||
|
|
@ -53,22 +55,10 @@ fun AppBarWithBackButtonAndIcon(
|
|||
}
|
||||
|
||||
@Preview(widthDp = 360, heightDp = 56, showBackground = true)
|
||||
@Preview(widthDp = 360, heightDp = 56, showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun PreviewAppBarWithBackButtonAndIconInLightTheme() {
|
||||
TangemTheme(isDark = false) {
|
||||
AppBarWithBackButtonAndIcon(
|
||||
text = "Title",
|
||||
iconRes = R.drawable.ic_qrcode_scan_24,
|
||||
onBackClick = {},
|
||||
onIconClick = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(widthDp = 360, heightDp = 56, showBackground = true)
|
||||
@Composable
|
||||
private fun PreviewAppBarWithBackButtonAndIconInDarkTheme() {
|
||||
TangemTheme(isDark = true) {
|
||||
private fun PreviewAppBarWithBackButtonAndIcon() {
|
||||
TangemThemePreview {
|
||||
AppBarWithBackButtonAndIcon(
|
||||
text = "Title",
|
||||
iconRes = R.drawable.ic_qrcode_scan_24,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.appbar
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.compose.animation.*
|
||||
import androidx.compose.foundation.background
|
||||
|
|
@ -17,6 +18,7 @@ import androidx.compose.ui.graphics.Color
|
|||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.tangem.core.ui.R
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
|
||||
/**
|
||||
|
|
@ -98,34 +100,10 @@ fun AppBarWithBackButtonAndIconContent(
|
|||
}
|
||||
|
||||
@Preview(widthDp = 360, heightDp = 56, showBackground = true)
|
||||
@Preview(widthDp = 360, heightDp = 56, showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun PreviewAppBarWithBackButtonAndIconInLightTheme() {
|
||||
TangemTheme(isDark = false) {
|
||||
AppBarWithBackButtonAndIconContent(
|
||||
text = "Title",
|
||||
onBackClick = {},
|
||||
iconContent = {
|
||||
Row {
|
||||
Icon(
|
||||
painter = painterResource(id = R.drawable.ic_qrcode_scan_24),
|
||||
tint = TangemTheme.colors.icon.primary1,
|
||||
contentDescription = null,
|
||||
)
|
||||
Icon(
|
||||
painter = painterResource(id = R.drawable.ic_flash_on_24),
|
||||
tint = TangemTheme.colors.icon.primary1,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(widthDp = 360, heightDp = 56, showBackground = true)
|
||||
@Composable
|
||||
private fun PreviewAppBarWithBackButtonAndIconInDarkTheme() {
|
||||
TangemTheme(isDark = true) {
|
||||
private fun PreviewAppBarWithBackButtonAndIcon() {
|
||||
TangemThemePreview {
|
||||
AppBarWithBackButtonAndIconContent(
|
||||
text = "Title",
|
||||
subtitle = "Subtitle",
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import com.tangem.core.ui.R
|
|||
import com.tangem.core.ui.components.SpacerWMax
|
||||
import com.tangem.core.ui.components.TangemTextFieldsDefault
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
|
||||
/**
|
||||
* App bar with close icon and search functionality
|
||||
|
|
@ -228,7 +229,7 @@ private fun ExpandedSearchView(
|
|||
@Preview
|
||||
@Composable
|
||||
private fun CollapsedSearchViewPreview() {
|
||||
TangemTheme {
|
||||
TangemThemePreview {
|
||||
ExpandableSearchView(
|
||||
title = "Choose Token",
|
||||
onBackClick = {},
|
||||
|
|
@ -245,7 +246,7 @@ private fun CollapsedSearchViewPreview() {
|
|||
@Preview
|
||||
@Composable
|
||||
private fun ExpandedSearchViewPreview() {
|
||||
TangemTheme {
|
||||
TangemThemePreview {
|
||||
ExpandableSearchView(
|
||||
title = "Choose Token",
|
||||
onBackClick = {},
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.atoms
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.runtime.Composable
|
||||
|
|
@ -8,6 +9,7 @@ import androidx.compose.ui.Alignment
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
|
||||
/**
|
||||
|
|
@ -52,17 +54,10 @@ private fun HandSample(modifier: Modifier = Modifier) {
|
|||
}
|
||||
|
||||
@Preview(showBackground = true, widthDp = 360)
|
||||
@Preview(showBackground = true, widthDp = 360, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun HandPreview_Light() {
|
||||
TangemTheme {
|
||||
HandSample()
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true, widthDp = 360)
|
||||
@Composable
|
||||
private fun HandPreview_Dark() {
|
||||
TangemTheme(isDark = true) {
|
||||
private fun HandPreview() {
|
||||
TangemThemePreview {
|
||||
HandSample()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
|||
import androidx.compose.ui.unit.Constraints
|
||||
import androidx.compose.ui.unit.TextUnit
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
|
||||
sealed class TextEllipsis {
|
||||
|
||||
|
|
@ -219,7 +220,7 @@ private fun offsetEndEllipsisText(
|
|||
@Preview(widthDp = 200)
|
||||
@Composable
|
||||
private fun EllipsisTexPreview(@PreviewParameter(EllipsisTexPreviewParameterProvider::class) ellipsis: TextEllipsis) {
|
||||
TangemTheme {
|
||||
TangemThemePreview {
|
||||
EllipsisText(
|
||||
text = "11111111111111111111111111111111111111111111111111 END",
|
||||
ellipsis = ellipsis,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.buttons
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
|
|
@ -15,6 +16,7 @@ import com.tangem.core.ui.R
|
|||
import com.tangem.core.ui.components.buttons.actions.ActionButton
|
||||
import com.tangem.core.ui.components.buttons.actions.ActionButtonConfig
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
|
|
@ -41,21 +43,12 @@ fun HorizontalActionChips(
|
|||
|
||||
// region Preview
|
||||
@Preview(widthDp = 360)
|
||||
@Preview(widthDp = 360, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun Preview_HorizontalActionChips_Light(
|
||||
private fun Preview_HorizontalActionChips(
|
||||
@PreviewParameter(ActionButtonConfigProvider::class) buttons: HorizontalActionChips,
|
||||
) {
|
||||
TangemTheme(isDark = false) {
|
||||
HorizontalActionChips(buttons = buttons.buttons)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(widthDp = 360)
|
||||
@Composable
|
||||
private fun Preview_HorizontalActionChips_Dark(
|
||||
@PreviewParameter(ActionButtonConfigProvider::class) buttons: HorizontalActionChips,
|
||||
) {
|
||||
TangemTheme(isDark = true) {
|
||||
TangemThemePreview {
|
||||
HorizontalActionChips(buttons = buttons.buttons)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.buttons
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.animation.animateColorAsState
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
|
|
@ -14,6 +15,7 @@ import androidx.compose.ui.draw.clip
|
|||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.core.ui.extensions.resolveReference
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
|
||||
/**
|
||||
|
|
@ -90,17 +92,10 @@ private fun SmallButton(config: SmallButtonConfig, isPrimary: Boolean, modifier:
|
|||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Preview(showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun Preview_SmallButton_Light() {
|
||||
TangemTheme(isDark = false) {
|
||||
ButtonsSample()
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun Preview_SmallButton_Dark() {
|
||||
TangemTheme(isDark = true) {
|
||||
private fun Preview_SmallButton() {
|
||||
TangemThemePreview {
|
||||
ButtonsSample()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.buttons.actions
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.animation.animateColorAsState
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
|
|
@ -23,6 +24,7 @@ import com.tangem.core.ui.components.SpacerW8
|
|||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.core.ui.extensions.resolveReference
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
|
||||
/**
|
||||
* Rounded action button
|
||||
|
|
@ -133,33 +135,19 @@ private fun Button(
|
|||
}
|
||||
|
||||
@Preview(group = "RoundedActionButton", showBackground = true)
|
||||
@Preview(group = "RoundedActionButton", showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun Preview_RoundedActionButton_Light(@PreviewParameter(ActionStateProvider::class) state: ActionButtonConfig) {
|
||||
TangemTheme(isDark = false) {
|
||||
RoundedActionButton(state)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(group = "RoundedActionButton", showBackground = true)
|
||||
@Composable
|
||||
private fun Preview_RoundedActionButton_Dark(@PreviewParameter(ActionStateProvider::class) state: ActionButtonConfig) {
|
||||
TangemTheme(isDark = true) {
|
||||
private fun Preview_RoundedActionButton(@PreviewParameter(ActionStateProvider::class) state: ActionButtonConfig) {
|
||||
TangemThemePreview {
|
||||
RoundedActionButton(state)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(group = "ActionButton", showBackground = true)
|
||||
@Preview(group = "ActionButton", showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun Preview_ActionButton_Light(@PreviewParameter(ActionStateProvider::class) state: ActionButtonConfig) {
|
||||
TangemTheme(isDark = false) {
|
||||
ActionButton(state)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(group = "ActionButton", showBackground = true)
|
||||
@Composable
|
||||
private fun Preview_ActionButton_Dark(@PreviewParameter(ActionStateProvider::class) state: ActionButtonConfig) {
|
||||
TangemTheme(isDark = true) {
|
||||
private fun Preview_ActionButton(@PreviewParameter(ActionStateProvider::class) state: ActionButtonConfig) {
|
||||
TangemThemePreview {
|
||||
ActionButton(state)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.buttons.segmentedbutton
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.animation.animateColorAsState
|
||||
import androidx.compose.animation.core.Spring
|
||||
import androidx.compose.animation.core.spring
|
||||
|
|
@ -20,6 +21,7 @@ import androidx.compose.ui.graphics.Color
|
|||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import kotlinx.collections.immutable.PersistentList
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
|
|
@ -102,29 +104,12 @@ inline fun <reified T> SegmentedButtons(
|
|||
}
|
||||
|
||||
@Preview
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun SegmentedButtonsPreview_Light(
|
||||
private fun SegmentedButtonsPreview(
|
||||
@PreviewParameter(SegmentedButtonsPreviewProvider::class) config: PersistentList<SegmentedButtonsConfigPreview>,
|
||||
) {
|
||||
TangemTheme {
|
||||
SegmentedButtons(
|
||||
config = config,
|
||||
onClick = {},
|
||||
) {
|
||||
Text(
|
||||
text = it.text,
|
||||
modifier = Modifier.padding(TangemTheme.dimens.spacing16),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun SegmentedButtonsPreview_Dark(
|
||||
@PreviewParameter(SegmentedButtonsPreviewProvider::class) config: PersistentList<SegmentedButtonsConfigPreview>,
|
||||
) {
|
||||
TangemTheme(isDark = true) {
|
||||
TangemThemePreview {
|
||||
SegmentedButtons(
|
||||
config = config,
|
||||
onClick = {},
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter
|
|||
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
||||
import com.tangem.core.ui.components.fields.visualtransformations.AmountVisualTransformation
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.utils.*
|
||||
import java.text.DecimalFormat
|
||||
|
||||
|
|
@ -128,7 +129,7 @@ private fun AmountTextFieldPreview(
|
|||
@PreviewParameter(AmountTextFieldPreviewProvider::class) amount: AmountTextFieldPreviewData,
|
||||
) {
|
||||
var text by remember { mutableStateOf(amount.value.orEmpty()) }
|
||||
TangemTheme {
|
||||
TangemThemePreview {
|
||||
AmountTextField(
|
||||
value = text,
|
||||
decimals = amount.decimals,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.icons.identicon
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.Canvas
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.size
|
||||
|
|
@ -13,6 +14,7 @@ import androidx.compose.ui.text.intl.Locale
|
|||
import androidx.compose.ui.text.toLowerCase
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.tangem.core.ui.res.LocalIsInDarkTheme
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
|
||||
private const val GAP_WIDTH = 1f
|
||||
|
|
@ -62,9 +64,10 @@ fun IdentIcon(address: String, modifier: Modifier = Modifier) {
|
|||
|
||||
//region preview
|
||||
@Preview
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun IdentIconPreview_Light() {
|
||||
TangemTheme {
|
||||
private fun IdentIconPreview() {
|
||||
TangemThemePreview {
|
||||
IdentIcon(
|
||||
address = "0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359",
|
||||
modifier = Modifier
|
||||
|
|
@ -72,17 +75,4 @@ private fun IdentIconPreview_Light() {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun IdentIconPreview_Dark() {
|
||||
TangemTheme(isDark = true) {
|
||||
IdentIcon(
|
||||
address = "0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359",
|
||||
modifier = Modifier
|
||||
.size(TangemTheme.dimens.size40),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.inputrow
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material3.Icon
|
||||
|
|
@ -16,6 +17,7 @@ import com.tangem.core.ui.components.currency.tokenicon.TokenIconState
|
|||
import com.tangem.core.ui.components.inputrow.inner.DividerContainer
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.core.ui.extensions.resolveReference
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
|
||||
/**
|
||||
|
|
@ -123,40 +125,36 @@ private fun InputRowApproxItem(
|
|||
|
||||
//region Preview
|
||||
@Preview
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun InputRowApproxPreview_Light() {
|
||||
TangemTheme {
|
||||
InputRowApprox(
|
||||
leftIcon = TokenIconState.Loading,
|
||||
leftTitle = TextReference.Str("Left title USD"),
|
||||
leftSubtitle = TextReference.Str("Left subtitle USD"),
|
||||
leftTitleEllipsisOffset = 3,
|
||||
rightIcon = TokenIconState.Loading,
|
||||
rightTitle = TextReference.Str("Right title Right title Right title Right title Right title USD"),
|
||||
rightSubtitle = TextReference.Str("Right subtitle Right subtitle Right subtitle USD"),
|
||||
rightTitleEllipsisOffset = 3,
|
||||
modifier = Modifier
|
||||
.background(TangemTheme.colors.background.action),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun InputRowApproxPreview_Dark() {
|
||||
TangemTheme(isDark = true) {
|
||||
InputRowApprox(
|
||||
leftIcon = TokenIconState.Loading,
|
||||
leftTitle = TextReference.Str("Left title Left title Left title Left title Left title USD"),
|
||||
leftSubtitle = TextReference.Str("Left subtitle Left subtitle Left subtitle USD"),
|
||||
leftTitleEllipsisOffset = 3,
|
||||
rightIcon = TokenIconState.Loading,
|
||||
rightTitle = TextReference.Str("Right title USD"),
|
||||
rightSubtitle = TextReference.Str("Right subtitle USD"),
|
||||
rightTitleEllipsisOffset = 3,
|
||||
modifier = Modifier
|
||||
.background(TangemTheme.colors.background.action),
|
||||
)
|
||||
private fun InputRowApproxPreview() {
|
||||
TangemThemePreview {
|
||||
Column {
|
||||
InputRowApprox(
|
||||
leftIcon = TokenIconState.Loading,
|
||||
leftTitle = TextReference.Str("Left title USD"),
|
||||
leftSubtitle = TextReference.Str("Left subtitle USD"),
|
||||
leftTitleEllipsisOffset = 3,
|
||||
rightIcon = TokenIconState.Loading,
|
||||
rightTitle = TextReference.Str("Right title Right title Right title Right title Right title USD"),
|
||||
rightSubtitle = TextReference.Str("Right subtitle Right subtitle Right subtitle USD"),
|
||||
rightTitleEllipsisOffset = 3,
|
||||
modifier = Modifier
|
||||
.background(TangemTheme.colors.background.action),
|
||||
)
|
||||
InputRowApprox(
|
||||
leftIcon = TokenIconState.Loading,
|
||||
leftTitle = TextReference.Str("Left title Left title Left title Left title Left title USD"),
|
||||
leftSubtitle = TextReference.Str("Left subtitle Left subtitle Left subtitle USD"),
|
||||
leftTitleEllipsisOffset = 3,
|
||||
rightIcon = TokenIconState.Loading,
|
||||
rightTitle = TextReference.Str("Right title USD"),
|
||||
rightSubtitle = TextReference.Str("Right subtitle USD"),
|
||||
rightTitleEllipsisOffset = 3,
|
||||
modifier = Modifier
|
||||
.background(TangemTheme.colors.background.action),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
//endregion
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.inputrow
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
|
|
@ -27,6 +28,7 @@ import com.tangem.core.ui.components.currency.tokenicon.LoadingIcon
|
|||
import com.tangem.core.ui.components.inputrow.inner.DividerContainer
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.core.ui.extensions.resolveReference
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
|
||||
/**
|
||||
|
|
@ -154,30 +156,12 @@ private fun InnerIcon(imageUrl: String) {
|
|||
|
||||
//region preview
|
||||
@Preview
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun InputRowBestRatePreview_Light(
|
||||
private fun InputRowBestRatePreview(
|
||||
@PreviewParameter(InputRowBestRatePreviewDataProvider::class) data: InputRowBestRatePreviewData,
|
||||
) {
|
||||
TangemTheme {
|
||||
InputRowBestRate(
|
||||
imageUrl = "",
|
||||
title = data.title,
|
||||
titleExtra = data.titleExtra,
|
||||
subtitle = data.subtitle,
|
||||
showTag = data.showTag,
|
||||
onIconClick = data.iconClick,
|
||||
modifier = Modifier
|
||||
.background(TangemTheme.colors.background.action),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun InputRowBestRatePreview_Dark(
|
||||
@PreviewParameter(InputRowBestRatePreviewDataProvider::class) data: InputRowBestRatePreviewData,
|
||||
) {
|
||||
TangemTheme(isDark = true) {
|
||||
TangemThemePreview {
|
||||
InputRowBestRate(
|
||||
imageUrl = "",
|
||||
title = data.title,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.inputrow
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
|
|
@ -19,6 +20,7 @@ import com.tangem.core.ui.R
|
|||
import com.tangem.core.ui.components.inputrow.inner.DividerContainer
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.core.ui.extensions.resolveReference
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
|
||||
/**
|
||||
|
|
@ -94,27 +96,12 @@ fun InputRowDefault(
|
|||
|
||||
//region preview
|
||||
@Preview
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun InputRowDefaultPreview_Light(
|
||||
private fun InputRowDefaultPreview(
|
||||
@PreviewParameter(InputRowDefaultPreviewDataProvider::class) data: InputRowDefaultPreviewData,
|
||||
) {
|
||||
TangemTheme {
|
||||
InputRowDefault(
|
||||
title = TextReference.Str(data.title),
|
||||
text = TextReference.Str(data.text),
|
||||
iconRes = data.iconRes,
|
||||
showDivider = data.showDivider,
|
||||
modifier = Modifier.background(TangemTheme.colors.background.action),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun InputRowDefaultPreview_Dark(
|
||||
@PreviewParameter(InputRowDefaultPreviewDataProvider::class) data: InputRowDefaultPreviewData,
|
||||
) {
|
||||
TangemTheme(isDark = true) {
|
||||
TangemThemePreview {
|
||||
InputRowDefault(
|
||||
title = TextReference.Str(data.title),
|
||||
text = TextReference.Str(data.text),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.inputrow
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
|
|
@ -22,6 +23,7 @@ import com.tangem.core.ui.components.inputrow.inner.DividerContainer
|
|||
import com.tangem.core.ui.components.fields.SimpleTextField
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.core.ui.extensions.resolveReference
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
|
||||
/**
|
||||
|
|
@ -106,28 +108,12 @@ fun InputRowEnter(
|
|||
|
||||
//region preview
|
||||
@Preview
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun InputRowEnterPreview_Light(
|
||||
private fun InputRowEnterPreview(
|
||||
@PreviewParameter(InputRowEnterPreviewDataProvider::class) data: InputRowEnterPreviewData,
|
||||
) {
|
||||
TangemTheme {
|
||||
InputRowEnter(
|
||||
title = TextReference.Str(data.title),
|
||||
text = data.text,
|
||||
iconRes = data.iconRes,
|
||||
showDivider = data.showDivider,
|
||||
onValueChange = {},
|
||||
modifier = Modifier.background(TangemTheme.colors.background.action),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun InputRowEnterPreview_Dark(
|
||||
@PreviewParameter(InputRowEnterPreviewDataProvider::class) data: InputRowEnterPreviewData,
|
||||
) {
|
||||
TangemTheme(isDark = true) {
|
||||
TangemThemePreview {
|
||||
InputRowEnter(
|
||||
title = TextReference.Str(data.title),
|
||||
text = data.text,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.inputrow
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
|
|
@ -16,6 +17,7 @@ import com.tangem.core.ui.components.inputrow.inner.DividerContainer
|
|||
import com.tangem.core.ui.components.fields.SimpleTextField
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.core.ui.extensions.resolveReference
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
|
||||
/**
|
||||
|
|
@ -92,28 +94,12 @@ fun InputRowEnterInfo(
|
|||
|
||||
//region preview
|
||||
@Preview
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun InputRowEnterInfoPreview_Light(
|
||||
private fun InputRowEnterInfoPreview(
|
||||
@PreviewParameter(InputRowEnterInfoPreviewDataProvider::class) data: InputRowEnterInfoPreviewData,
|
||||
) {
|
||||
TangemTheme {
|
||||
InputRowEnterInfo(
|
||||
title = data.title,
|
||||
text = data.text,
|
||||
info = data.info,
|
||||
showDivider = data.showDivider,
|
||||
onValueChange = {},
|
||||
modifier = Modifier.background(TangemTheme.colors.background.action),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun InputRowEnterInfoPreview_Dark(
|
||||
@PreviewParameter(InputRowEnterInfoPreviewDataProvider::class) data: InputRowEnterInfoPreviewData,
|
||||
) {
|
||||
TangemTheme(isDark = true) {
|
||||
TangemThemePreview {
|
||||
InputRowEnterInfo(
|
||||
title = data.title,
|
||||
text = data.text,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.inputrow
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
|
|
@ -22,6 +23,7 @@ import com.tangem.core.ui.components.currency.tokenicon.TokenIcon
|
|||
import com.tangem.core.ui.components.currency.tokenicon.TokenIconState
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.core.ui.extensions.resolveReference
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
|
||||
/**
|
||||
|
|
@ -120,31 +122,12 @@ fun InputRowImage(
|
|||
|
||||
//region preview
|
||||
@Preview
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun InputRowInputEnterInfoPreview_Light(
|
||||
private fun InputRowInputEnterInfoPreview(
|
||||
@PreviewParameter(InputRowImagePreviewDataProvider::class) data: InputRowImagePreviewData,
|
||||
) {
|
||||
TangemTheme {
|
||||
InputRowImage(
|
||||
title = data.title,
|
||||
modifier = Modifier.background(TangemTheme.colors.background.action),
|
||||
subtitle = data.subtitle,
|
||||
caption = data.caption,
|
||||
tokenIconState = data.iconState,
|
||||
iconRes = data.actionIconRes,
|
||||
onIconClick = {},
|
||||
showNetworkIcon = false,
|
||||
showDivider = data.showDivider,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun InputRowImagePreview_Dark(
|
||||
@PreviewParameter(InputRowImagePreviewDataProvider::class) data: InputRowImagePreviewData,
|
||||
) {
|
||||
TangemTheme(isDark = true) {
|
||||
TangemThemePreview {
|
||||
InputRowImage(
|
||||
title = data.title,
|
||||
modifier = Modifier.background(TangemTheme.colors.background.action),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.inputrow
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.animation.AnimatedContent
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.*
|
||||
|
|
@ -22,6 +23,7 @@ import com.tangem.core.ui.components.inputrow.inner.DividerContainer
|
|||
import com.tangem.core.ui.components.inputrow.inner.PasteButton
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.core.ui.extensions.resolveReference
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import kotlinx.coroutines.delay
|
||||
|
||||
|
|
@ -149,11 +151,12 @@ private fun RowScope.InputIcon(isLoading: Boolean, value: String) {
|
|||
|
||||
//region preview
|
||||
@Preview
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun InputRowRecipientPreview_Light(
|
||||
private fun InputRowRecipientPreview(
|
||||
@PreviewParameter(InputRowRecipientPreviewDataProvider::class) value: InputRowRecipientPreviewData,
|
||||
) {
|
||||
TangemTheme {
|
||||
TangemThemePreview {
|
||||
InputRowRecipient(
|
||||
value = value.value,
|
||||
title = TextReference.Res(R.string.send_recipient),
|
||||
|
|
@ -169,27 +172,6 @@ private fun InputRowRecipientPreview_Light(
|
|||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun InputRowRecipientPreview_Dark(
|
||||
@PreviewParameter(InputRowRecipientPreviewDataProvider::class) value: InputRowRecipientPreviewData,
|
||||
) {
|
||||
TangemTheme(isDark = true) {
|
||||
InputRowRecipient(
|
||||
value = value.value,
|
||||
title = TextReference.Res(R.string.send_recipient),
|
||||
placeholder = TextReference.Res(R.string.send_optional_field),
|
||||
error = TextReference.Str("Error"),
|
||||
isLoading = value.isLoading,
|
||||
isError = value.isError,
|
||||
showDivider = true,
|
||||
onValueChange = {},
|
||||
onPasteClick = {},
|
||||
modifier = Modifier.background(TangemTheme.colors.background.primary),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private data class InputRowRecipientPreviewData(
|
||||
val value: String,
|
||||
val isError: Boolean,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.inputrow
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
|
|
@ -15,6 +16,7 @@ import com.tangem.core.ui.components.icons.identicon.IdentIcon
|
|||
import com.tangem.core.ui.components.inputrow.inner.DividerContainer
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.core.ui.extensions.resolveReference
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
|
||||
/**
|
||||
|
|
@ -79,9 +81,10 @@ fun InputRowRecipientDefault(
|
|||
|
||||
//region preview
|
||||
@Preview
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun InputRowRecipientPreview_Light() {
|
||||
TangemTheme {
|
||||
private fun InputRowRecipientPreview() {
|
||||
TangemThemePreview {
|
||||
InputRowRecipientDefault(
|
||||
value = "0x391316d97a07027a0702c8A002c8A0C25d8470",
|
||||
title = TextReference.Res(R.string.send_recipient),
|
||||
|
|
@ -90,17 +93,4 @@ private fun InputRowRecipientPreview_Light() {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun InputRowRecipientPreview_Dark() {
|
||||
TangemTheme(isDark = true) {
|
||||
InputRowRecipientDefault(
|
||||
value = "0x391316d97a07027a0702c8A002c8A0C25d8470",
|
||||
title = TextReference.Res(R.string.send_recipient),
|
||||
showDivider = false,
|
||||
modifier = Modifier.background(TangemTheme.colors.background.primary),
|
||||
)
|
||||
}
|
||||
}
|
||||
//endregion
|
||||
|
|
@ -22,6 +22,7 @@ import androidx.compose.ui.res.stringResource
|
|||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.tangem.core.ui.R
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.utils.DEFAULT_ANIMATION_DURATION
|
||||
|
||||
/**
|
||||
|
|
@ -100,7 +101,7 @@ fun CrossIcon(onClick: (String) -> Unit, modifier: Modifier = Modifier) {
|
|||
@Composable
|
||||
private fun PasteButtonPreview() {
|
||||
var isVisible by remember { mutableStateOf(true) }
|
||||
TangemTheme {
|
||||
TangemThemePreview {
|
||||
PasteButton(
|
||||
isPasteButtonVisible = isVisible,
|
||||
onClick = { isVisible = !isVisible },
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.marketprice
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.animation.AnimatedContent
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.*
|
||||
|
|
@ -19,6 +20,7 @@ import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameter
|
|||
import androidx.compose.ui.unit.Dp
|
||||
import com.tangem.core.ui.R
|
||||
import com.tangem.core.ui.components.RectangleShimmer
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.utils.BigDecimalFormatter
|
||||
|
||||
|
|
@ -203,23 +205,13 @@ private fun QuoteTimeStatus() {
|
|||
|
||||
// region Preview
|
||||
@Preview(showBackground = true, widthDp = 360)
|
||||
@Preview(showBackground = true, widthDp = 360, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun Preview_MarketPriceBlock_Light(
|
||||
private fun Preview_MarketPriceBlock(
|
||||
@PreviewParameter(WalletMarketPriceBlockStateProvider::class)
|
||||
state: MarketPriceBlockState,
|
||||
) {
|
||||
TangemTheme(isDark = false) {
|
||||
MarketPriceBlock(state = state)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true, widthDp = 360)
|
||||
@Composable
|
||||
private fun Preview_MarketPriceBlock_Dark(
|
||||
@PreviewParameter(WalletMarketPriceBlockStateProvider::class)
|
||||
state: MarketPriceBlockState,
|
||||
) {
|
||||
TangemTheme(isDark = true) {
|
||||
TangemThemePreview {
|
||||
MarketPriceBlock(state = state)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.notifications
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.foundation.Image
|
||||
|
|
@ -29,6 +30,7 @@ import com.tangem.core.ui.components.*
|
|||
import com.tangem.core.ui.components.buttons.common.TangemButtonSize
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.core.ui.extensions.resolveReference
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.components.notifications.NotificationConfig.ButtonsState as NotificationButtonsState
|
||||
|
||||
|
|
@ -269,22 +271,13 @@ private fun CloseableIconButton(onClick: (() -> Unit)?, modifier: Modifier = Mod
|
|||
}
|
||||
|
||||
@Preview
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun Preview_Notification_Light(
|
||||
private fun Preview_Notification(
|
||||
@PreviewParameter(NotificationConfigProvider::class)
|
||||
config: NotificationConfig,
|
||||
) {
|
||||
TangemTheme(isDark = false) {
|
||||
Notification(config)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun Preview_Notification_Dark(
|
||||
@PreviewParameter(NotificationConfigProvider::class) config: NotificationConfig,
|
||||
) {
|
||||
TangemTheme(isDark = true) {
|
||||
TangemThemePreview {
|
||||
Notification(config)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.notifications
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
|
|
@ -32,6 +33,7 @@ import com.tangem.core.ui.extensions.wrappedList
|
|||
import com.tangem.core.ui.res.LocalIsInDarkTheme
|
||||
import com.tangem.core.ui.res.TangemColorPalette.Dark6
|
||||
import com.tangem.core.ui.res.TangemColorPalette.Light4
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
|
||||
/**
|
||||
|
|
@ -149,21 +151,12 @@ fun NotificationWithBackground(config: NotificationConfig, modifier: Modifier =
|
|||
|
||||
//region preview
|
||||
@Preview
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun NotificationWithBackgroundPreview_Light(
|
||||
private fun NotificationWithBackgroundPreview(
|
||||
@PreviewParameter(NotificationWithBackgroundPreviewProvider::class) config: NotificationConfig,
|
||||
) {
|
||||
TangemTheme {
|
||||
NotificationWithBackground(config = config)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun NotificationWithBackgroundPreview_Dark(
|
||||
@PreviewParameter(NotificationWithBackgroundPreviewProvider::class) config: NotificationConfig,
|
||||
) {
|
||||
TangemTheme(isDark = true) {
|
||||
TangemThemePreview {
|
||||
NotificationWithBackground(config = config)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import androidx.compose.ui.tooling.preview.Preview
|
|||
import com.tangem.core.ui.R
|
||||
import com.tangem.core.ui.components.SpacerH28
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
|
||||
/**
|
||||
* Simple clickable action row, without input and icon
|
||||
|
|
@ -66,7 +67,7 @@ fun SimpleActionRow(title: String, description: String, modifier: Modifier = Mod
|
|||
@Composable
|
||||
private fun SimpleActionRowPreview() {
|
||||
Column {
|
||||
TangemTheme(isDark = false) {
|
||||
TangemThemePreview(isDark = false) {
|
||||
SimpleActionRow(
|
||||
title = "Title",
|
||||
description = "Description",
|
||||
|
|
@ -75,7 +76,7 @@ private fun SimpleActionRowPreview() {
|
|||
|
||||
SpacerH28()
|
||||
|
||||
TangemTheme(isDark = false) {
|
||||
TangemThemePreview(isDark = false) {
|
||||
SimpleActionRow(
|
||||
title = "Title",
|
||||
description = "Description",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.rows
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.compose.animation.animateColorAsState
|
||||
|
|
@ -21,6 +22,7 @@ import com.tangem.core.ui.components.atoms.text.EllipsisText
|
|||
import com.tangem.core.ui.components.atoms.text.TextEllipsis
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.core.ui.extensions.resolveReference
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
|
||||
@Composable
|
||||
|
|
@ -132,25 +134,10 @@ private fun RowScope.SelectorValueContent(
|
|||
}
|
||||
|
||||
@Preview
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun SelectorRowItemPreview_Light() {
|
||||
TangemTheme {
|
||||
SelectorRowItem(
|
||||
titleRes = R.string.common_fee_selector_option_slow,
|
||||
iconRes = R.drawable.ic_tortoise_24,
|
||||
preDot = TextReference.Str("1000 ETH"),
|
||||
postDot = TextReference.Str("1000 $"),
|
||||
ellipsizeOffset = 4,
|
||||
isSelected = true,
|
||||
onSelect = { },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun SelectorRowItemPreview_Dark() {
|
||||
TangemTheme(isDark = true) {
|
||||
private fun SelectorRowItemPreview() {
|
||||
TangemThemePreview {
|
||||
SelectorRowItem(
|
||||
titleRes = R.string.common_fee_selector_option_slow,
|
||||
iconRes = R.drawable.ic_tortoise_24,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.transactions
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
|
|
@ -32,6 +33,7 @@ import com.tangem.core.ui.extensions.TextReference
|
|||
import com.tangem.core.ui.extensions.resolveReference
|
||||
import com.tangem.core.ui.extensions.resourceReference
|
||||
import com.tangem.core.ui.extensions.stringReference
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import java.util.UUID
|
||||
|
||||
|
|
@ -318,21 +320,10 @@ private fun LockedContent(modifier: Modifier = Modifier) {
|
|||
}
|
||||
|
||||
@Preview
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun Preview_TransactionItem_LightTheme(
|
||||
@PreviewParameter(TransactionItemStateProvider::class) state: TransactionState,
|
||||
) {
|
||||
TangemTheme(isDark = false) {
|
||||
Transaction(state = state, isBalanceHidden = false)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun Preview_TransactionItem_DarkTheme(
|
||||
@PreviewParameter(TransactionItemStateProvider::class) state: TransactionState,
|
||||
) {
|
||||
TangemTheme(isDark = true) {
|
||||
private fun Preview_TransactionItem(@PreviewParameter(TransactionItemStateProvider::class) state: TransactionState) {
|
||||
TangemThemePreview {
|
||||
Transaction(state = state, isBalanceHidden = false)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.transactions
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
|
|
@ -15,6 +16,7 @@ import androidx.compose.ui.res.painterResource
|
|||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.tangem.core.ui.R
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.utils.DateTimeFormatters
|
||||
import com.tangem.core.ui.utils.toTimeFormat
|
||||
|
|
@ -62,23 +64,10 @@ fun TransactionDoneTitle(@StringRes titleRes: Int, date: Long, modifier: Modifie
|
|||
|
||||
// region Previews
|
||||
@Preview
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun TransactionDoneTitlePreview_Light() {
|
||||
TangemTheme {
|
||||
TransactionDoneTitle(
|
||||
titleRes = R.string.sent_transaction_sent_title,
|
||||
date = 0,
|
||||
modifier = Modifier
|
||||
.background(TangemTheme.colors.background.tertiary)
|
||||
.padding(TangemTheme.dimens.spacing16),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun TransactionDoneTitlePreview_Dark() {
|
||||
TangemTheme(isDark = true) {
|
||||
private fun TransactionDoneTitlePreview() {
|
||||
TangemThemePreview {
|
||||
TransactionDoneTitle(
|
||||
titleRes = R.string.sent_transaction_sent_title,
|
||||
date = 0,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.transactions
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
|
|
@ -11,6 +12,7 @@ import androidx.compose.ui.Alignment
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.tangem.core.ui.components.transactions.state.TxHistoryState.TxHistoryItemState
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import java.util.UUID
|
||||
|
||||
|
|
@ -42,19 +44,10 @@ internal fun TxHistoryGroupTitle(config: TxHistoryItemState.GroupTitle, modifier
|
|||
}
|
||||
|
||||
@Preview
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun Preview_TransactionsBlockGroupTitle_Light() {
|
||||
TangemTheme(isDark = false) {
|
||||
TxHistoryGroupTitle(
|
||||
config = TxHistoryItemState.GroupTitle(title = "Today", itemKey = UUID.randomUUID().toString()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun Preview_TransactionsBlockGroupTitle_Dark() {
|
||||
TangemTheme(isDark = true) {
|
||||
private fun Preview_TransactionsBlockGroupTitle() {
|
||||
TangemThemePreview {
|
||||
TxHistoryGroupTitle(
|
||||
config = TxHistoryItemState.GroupTitle(title = "Today", itemKey = UUID.randomUUID().toString()),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.transactions
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.*
|
||||
|
|
@ -12,6 +13,7 @@ import androidx.compose.ui.res.painterResource
|
|||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.tangem.core.ui.R
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
|
||||
/**
|
||||
|
|
@ -59,17 +61,10 @@ internal fun TxHistoryTitle(onExploreClick: () -> Unit, modifier: Modifier = Mod
|
|||
}
|
||||
|
||||
@Preview
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun Preview_TransactionsBlockTitle_Light() {
|
||||
TangemTheme(isDark = false) {
|
||||
TxHistoryTitle(onExploreClick = {})
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun Preview_TransactionsBlockTitle_Dark() {
|
||||
TangemTheme(isDark = true) {
|
||||
private fun Preview_TransactionsBlockTitle() {
|
||||
TangemThemePreview {
|
||||
TxHistoryTitle(onExploreClick = {})
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.core.ui.components.transactions.empty
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material3.Icon
|
||||
|
|
@ -15,6 +16,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter
|
|||
import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider
|
||||
import com.tangem.core.ui.components.buttons.actions.ActionButton
|
||||
import com.tangem.core.ui.extensions.resolveReference
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
|
||||
/**
|
||||
|
|
@ -87,20 +89,11 @@ private fun PairButtons(state: EmptyTransactionsBlockState.ButtonsState.PairButt
|
|||
|
||||
@Composable
|
||||
@Preview(widthDp = 360, showBackground = true)
|
||||
private fun EmptyTransactionBlock_Light(
|
||||
@Preview(widthDp = 360, showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
private fun EmptyTransactionBlockPreview(
|
||||
@PreviewParameter(EmptyTransactionBlockStateProvider::class) state: EmptyTransactionsBlockState,
|
||||
) {
|
||||
TangemTheme {
|
||||
EmptyTransactionBlock(state = state)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview(widthDp = 360, showBackground = true)
|
||||
private fun EmptyTransactionBlock_Dark(
|
||||
@PreviewParameter(EmptyTransactionBlockStateProvider::class) state: EmptyTransactionsBlockState,
|
||||
) {
|
||||
TangemTheme(isDark = true) {
|
||||
TangemThemePreview {
|
||||
EmptyTransactionBlock(state = state)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package com.tangem.core.ui.res
|
||||
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
|
||||
@Composable
|
||||
fun TangemThemePreview(
|
||||
isDark: Boolean? = null,
|
||||
typography: TangemTypography = TangemTheme.typography,
|
||||
dimens: TangemDimens = TangemTheme.dimens,
|
||||
content: @Composable () -> Unit,
|
||||
) {
|
||||
val isDarkTheme = isDark ?: isSystemInDarkTheme()
|
||||
|
||||
TangemTheme(
|
||||
isDark = isDarkTheme,
|
||||
typography = typography,
|
||||
dimens = dimens,
|
||||
content = content,
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue