Updated on 2026-08-14

This commit is contained in:
Tangem 2024-04-27 15:35:08 +03:00
parent b96f007568
commit fa7a381e04
131 changed files with 736 additions and 1778 deletions

View file

@ -23,6 +23,7 @@ import com.tangem.core.ui.extensions.TextReference
import com.tangem.core.ui.extensions.resolveReference
import com.tangem.core.ui.extensions.stringReference
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview
import com.tangem.feature.swap.domain.models.ui.FeeType
import com.tangem.feature.swap.models.states.ChooseFeeBottomSheetConfig
import com.tangem.feature.swap.models.states.FeeItemState
@ -168,7 +169,7 @@ private fun ChooseFeeBottomSheetContent_Preview() {
),
).toImmutableList()
Column {
TangemTheme(isDark = true) {
TangemThemePreview(isDark = true) {
ChooseFeeBottomSheetContent(
ChooseFeeBottomSheetConfig(
selectedFee = FeeType.NORMAL,
@ -183,7 +184,7 @@ private fun ChooseFeeBottomSheetContent_Preview() {
SpacerH24()
TangemTheme(isDark = false) {
TangemThemePreview(isDark = false) {
ChooseFeeBottomSheetContent(
ChooseFeeBottomSheetConfig(
selectedFee = FeeType.NORMAL,

View file

@ -18,6 +18,7 @@ import com.tangem.core.ui.components.bottomsheets.TangemBottomSheet
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
import com.tangem.core.ui.extensions.stringReference
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview
import com.tangem.feature.swap.models.states.ChooseProviderBottomSheetConfig
import com.tangem.feature.swap.models.states.PercentDifference
import com.tangem.feature.swap.models.states.ProviderState
@ -128,7 +129,7 @@ private fun ChooseProviderBottomSheet_Preview() {
alertText = stringReference("Unavailable"),
),
)
TangemTheme(isDark = false) {
TangemThemePreview(isDark = false) {
ChooseProviderBottomSheetContent(
ChooseProviderBottomSheetConfig(
selectedProviderId = "1",

View file

@ -12,6 +12,7 @@ import com.tangem.core.ui.components.rows.SimpleActionRow
import com.tangem.core.ui.extensions.resolveReference
import com.tangem.core.ui.extensions.stringReference
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview
import com.tangem.feature.swap.domain.models.ui.FeeType
import com.tangem.feature.swap.models.states.FeeItemState
@ -63,13 +64,13 @@ private fun FeeItemPreview() {
onClick = {},
)
Column {
TangemTheme(isDark = false) {
TangemThemePreview(isDark = false) {
FeeItem(state = state)
}
SpacerH24()
TangemTheme(isDark = true) {
TangemThemePreview(isDark = true) {
FeeItem(state = state)
}
}

View file

@ -1,5 +1,6 @@
package com.tangem.feature.swap.ui
import android.content.res.Configuration
import androidx.compose.animation.AnimatedContent
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
@ -27,6 +28,7 @@ import com.tangem.core.ui.components.RectangleShimmer
import com.tangem.core.ui.extensions.resolveReference
import com.tangem.core.ui.extensions.stringReference
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview
import com.tangem.feature.swap.models.states.PercentDifference
import com.tangem.feature.swap.models.states.ProviderState
@ -390,25 +392,12 @@ private fun PermissionBadgeItem(modifier: Modifier = Modifier) {
// region Preview
@Preview(showBackground = true, widthDp = 360)
@Preview(showBackground = true, widthDp = 360, uiMode = Configuration.UI_MODE_NIGHT_YES)
@Composable
private fun ProviderItemPreview_Light(
private fun ProviderItemPreview(
@PreviewParameter(ProviderItemParameterProvider::class) state: Pair<ProviderState, Boolean>,
) {
TangemTheme {
ProviderItem(
modifier = Modifier.background(TangemTheme.colors.background.action),
state = state.first,
isSelected = state.second,
)
}
}
@Preview(showBackground = true, widthDp = 360)
@Composable
private fun ProviderItemPreview_Dark(
@PreviewParameter(ProviderItemParameterProvider::class) state: Pair<ProviderState, Boolean>,
) {
TangemTheme(isDark = true) {
TangemThemePreview {
ProviderItem(
modifier = Modifier.background(TangemTheme.colors.background.action),
state = state.first,

View file

@ -1,5 +1,6 @@
package com.tangem.feature.swap.ui
import android.content.res.Configuration
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
@ -17,6 +18,7 @@ import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
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
import com.tangem.feature.swap.models.ApprovePermissionButton
import com.tangem.feature.swap.models.ApproveType
import com.tangem.feature.swap.models.CancelPermissionButton
@ -291,17 +293,10 @@ private fun getTitleForApproveType(approveType: ApproveType): String = when (app
// region preview
@Preview
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
@Composable
private fun Preview_AgreementBottomSheet_InLightTheme() {
TangemTheme(isDark = false) {
SwapPermissionBottomSheetContent(content = previewData)
}
}
@Preview
@Composable
private fun Preview_AgreementBottomSheet_InDarkTheme() {
TangemTheme(isDark = true) {
private fun Preview_AgreementBottomSheet() {
TangemThemePreview {
SwapPermissionBottomSheetContent(content = previewData)
}
}

View file

@ -1,5 +1,6 @@
package com.tangem.feature.swap.ui
import android.content.res.Configuration
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
@ -30,6 +31,7 @@ import com.tangem.core.ui.extensions.getActiveIconResByCoinId
import com.tangem.core.ui.extensions.resolveReference
import com.tangem.core.ui.extensions.stringReference
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview
import com.tangem.feature.swap.domain.models.ui.FeeType
import com.tangem.feature.swap.domain.models.ui.PriceImpact
import com.tangem.feature.swap.models.*
@ -512,9 +514,10 @@ private val state = SwapStateHolder(
)
@Preview
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
@Composable
private fun SwapScreenContentPreview() {
TangemTheme(isDark = false) {
TangemThemePreview {
SwapScreenContent(state = state, modifier = Modifier)
}
}

View file

@ -27,6 +27,7 @@ import com.tangem.core.ui.decorations.roundedShapeItemDecoration
import com.tangem.core.ui.extensions.resolveReference
import com.tangem.core.ui.extensions.stringReference
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview
import com.tangem.feature.swap.models.*
import com.tangem.feature.swap.presentation.R
import kotlinx.collections.immutable.ImmutableList
@ -303,7 +304,7 @@ private val title = TokenToSelectState.Title(
@Preview
@Composable
private fun TokenScreenPreview() {
TangemTheme(isDark = false) {
TangemThemePreview {
SwapSelectTokenScreen(
state = SwapSelectTokenStateHolder(
availableTokens = listOf(title, token, token, token).toImmutableList(),
@ -320,7 +321,7 @@ private fun TokenScreenPreview() {
@Preview
@Composable
private fun EmptyTokensListPreview() {
TangemTheme(isDark = false) {
TangemThemePreview {
EmptyTokensList()
}
}

View file

@ -1,5 +1,6 @@
package com.tangem.feature.swap.ui
import android.content.res.Configuration
import androidx.annotation.StringRes
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
@ -18,6 +19,7 @@ import com.tangem.core.ui.components.inputrow.InputRowImage
import com.tangem.core.ui.components.transactions.TransactionDoneTitle
import com.tangem.core.ui.extensions.TextReference
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview
import com.tangem.feature.swap.domain.models.domain.ExchangeProviderType
import com.tangem.feature.swap.models.SwapSuccessStateHolder
import com.tangem.feature.swap.presentation.R
@ -167,19 +169,11 @@ private val state = SwapSuccessStateHolder(
)
@Preview(showBackground = true)
@Preview(showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
@Composable
private fun Preview_Success_InLightTheme() {
TangemTheme(isDark = false) {
private fun Preview_Success() {
TangemThemePreview {
SwapSuccessScreen(state) {}
}
}
@Preview(showBackground = true)
@Composable
private fun Preview_Success_InDarkTheme() {
TangemTheme(isDark = true) {
SwapSuccessScreen(state) {}
}
}
// endregion preview

View file

@ -38,6 +38,7 @@ import coil.request.ImageRequest
import com.tangem.core.ui.R
import com.tangem.core.ui.components.*
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview
import com.tangem.core.ui.utils.ImageBackgroundContrastChecker
import com.tangem.feature.swap.domain.models.ui.PriceImpact
import com.tangem.feature.swap.models.TransactionCardType
@ -498,7 +499,7 @@ private fun makePriceImpactBalanceWarning(value: String, priceImpactPercents: In
@Preview(widthDp = 328, heightDp = 116, showBackground = true)
@Composable
private fun Preview_TransactionCard_InLightTheme() {
TangemTheme(isDark = false) {
TangemThemePreview(isDark = false) {
TransactionCardPreview()
}
}
@ -506,7 +507,7 @@ private fun Preview_TransactionCard_InLightTheme() {
@Preview(widthDp = 328, heightDp = 116, showBackground = true)
@Composable
private fun Preview_TransactionCardWithPriceImpact_InLightTheme() {
TangemTheme(isDark = false) {
TangemThemePreview(isDark = false) {
TransactionCardPreviewWithPriceImpact()
}
}
@ -514,7 +515,7 @@ private fun Preview_TransactionCardWithPriceImpact_InLightTheme() {
@Preview(widthDp = 328, heightDp = 116, showBackground = true)
@Composable
private fun Preview_TransactionCardWithoutPriceImpact_InLightTheme() {
TangemTheme(isDark = false) {
TangemThemePreview(isDark = false) {
TransactionCardPreviewWithoutPriceImpact()
}
}
@ -522,7 +523,7 @@ private fun Preview_TransactionCardWithoutPriceImpact_InLightTheme() {
@Preview(widthDp = 328, heightDp = 116, showBackground = true)
@Composable
private fun Preview_TransactionCard_InDarkTheme() {
TangemTheme(isDark = false) {
TangemThemePreview(isDark = false) {
TransactionCardPreview()
}
}
@ -530,7 +531,7 @@ private fun Preview_TransactionCard_InDarkTheme() {
@Preview(widthDp = 328, heightDp = 116, showBackground = true)
@Composable
private fun Preview_TransactionCardWithPriceImpact_InDarkTheme() {
TangemTheme(isDark = false) {
TangemThemePreview(isDark = false) {
TransactionCardPreviewWithPriceImpact()
}
}
@ -538,7 +539,7 @@ private fun Preview_TransactionCardWithPriceImpact_InDarkTheme() {
@Preview(widthDp = 328, heightDp = 116, showBackground = true)
@Composable
private fun Preview_TransactionCardWithoutPriceImpact_InDarkTheme() {
TangemTheme(isDark = false) {
TangemThemePreview(isDark = false) {
TransactionCardPreviewWithoutPriceImpact()
}
}

View file

@ -1,5 +1,6 @@
package com.tangem.feature.swap.ui
import android.content.res.Configuration
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxHeight
@ -14,6 +15,7 @@ import com.google.accompanist.web.rememberWebViewState
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheet
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview
import com.tangem.feature.swap.models.states.WebViewBottomSheetConfig
@Composable
@ -55,21 +57,10 @@ private fun WebViewBottomSheetContent(content: WebViewBottomSheetConfig) {
}
@Preview
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
@Composable
private fun Preview_WebViewBottomSheetContent_InLightTheme() {
TangemTheme(isDark = false) {
WebViewBottomSheetContent(
content = WebViewBottomSheetConfig(
url = "https://tangem.com/en/",
),
)
}
}
@Preview
@Composable
private fun Preview_WebViewBottomSheetContent_InDarkTheme() {
TangemTheme(isDark = true) {
private fun Preview_WebViewBottomSheetContent() {
TangemThemePreview {
WebViewBottomSheetContent(
content = WebViewBottomSheetConfig(
url = "https://tangem.com/en/",