diff --git a/core/ui/src/main/java/com/tangem/core/ui/ds/button/GhostTangemButton.kt b/core/ui/src/main/java/com/tangem/core/ui/ds/button/GhostTangemButton.kt index f135158d06..6b705ae86d 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/ds/button/GhostTangemButton.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/ds/button/GhostTangemButton.kt @@ -1,7 +1,6 @@ package com.tangem.core.ui.ds.button import android.content.res.Configuration -import androidx.annotation.DrawableRes import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -15,6 +14,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.tooling.preview.PreviewParameterProvider import androidx.compose.ui.unit.dp import com.tangem.core.ui.R +import com.tangem.core.ui.ds.image.TangemIconUM import com.tangem.core.ui.extensions.TextReference import com.tangem.core.ui.extensions.stringReference import com.tangem.core.ui.res.TangemTheme @@ -32,7 +32,7 @@ fun GhostTangemButton(buttonUM: TangemButtonUM, modifier: Modifier = Modifier) { onClick = buttonUM.onClick, modifier = modifier, text = buttonUM.text, - iconRes = buttonUM.iconRes, + tangemIconUM = buttonUM.tangemIconUM, iconPosition = buttonUM.iconPosition, isEnabled = buttonUM.isEnabled, isLoading = buttonUM.isLoading, @@ -47,7 +47,7 @@ fun GhostTangemButton(buttonUM: TangemButtonUM, modifier: Modifier = Modifier) { * @param onClick Lambda to be invoked when the button is clicked. * @param modifier Modifier to be applied to the button. * @param text TextReference for the button label. - * @param iconRes Drawable resource ID for the icon to be displayed in the button. + * @param tangemIconUM Icon for the icon to be displayed in the button. * @param iconPosition Position of the icon (Start or End). * @param isEnabled Boolean indicating whether the button is enabled. * @param isLoading Boolean indicating whether the button is in a loading state. @@ -60,7 +60,7 @@ fun GhostTangemButton( onClick: () -> Unit, modifier: Modifier = Modifier, text: TextReference? = null, - @DrawableRes iconRes: Int? = null, + tangemIconUM: TangemIconUM? = null, isEnabled: Boolean = true, isLoading: Boolean = false, size: TangemButtonSize = TangemButtonSize.X15, @@ -83,7 +83,7 @@ fun GhostTangemButton( hasPadding = false, size = size, iconPosition = iconPosition, - iconRes = iconRes, + tangemIconUM = tangemIconUM, ) } @@ -116,7 +116,16 @@ private fun GhostTangemButton_Preview( text = text, size = TangemButtonSize.X15, iconPosition = iconPosition, - iconRes = R.drawable.ic_tangem_24, + tangemIconUM = TangemIconUM.Icon( + iconRes = R.drawable.ic_tangem_24, + tintReference = { + if (isEnabled) { + TangemTheme.colors2.graphic.neutral.primary + } else { + TangemTheme.colors2.graphic.neutral.quaternary + } + }, + ), isEnabled = isEnabled, isLoading = isLoading, ) diff --git a/core/ui/src/main/java/com/tangem/core/ui/ds/button/OutlineTangemButton.kt b/core/ui/src/main/java/com/tangem/core/ui/ds/button/OutlineTangemButton.kt index 0ffd8e912a..d4582cd82f 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/ds/button/OutlineTangemButton.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/ds/button/OutlineTangemButton.kt @@ -1,7 +1,6 @@ package com.tangem.core.ui.ds.button import android.content.res.Configuration -import androidx.annotation.DrawableRes import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.layout.Arrangement @@ -16,6 +15,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.tooling.preview.PreviewParameterProvider import androidx.compose.ui.unit.dp import com.tangem.core.ui.R +import com.tangem.core.ui.ds.image.TangemIconUM import com.tangem.core.ui.extensions.TextReference import com.tangem.core.ui.extensions.stringReference import com.tangem.core.ui.res.TangemTheme @@ -33,7 +33,7 @@ fun OutlineTangemButton(buttonUM: TangemButtonUM, modifier: Modifier = Modifier) onClick = buttonUM.onClick, modifier = modifier, text = buttonUM.text, - iconRes = buttonUM.iconRes, + tangemIconUM = buttonUM.tangemIconUM, iconPosition = buttonUM.iconPosition, isEnabled = buttonUM.isEnabled, isLoading = buttonUM.isLoading, @@ -48,7 +48,7 @@ fun OutlineTangemButton(buttonUM: TangemButtonUM, modifier: Modifier = Modifier) * @param onClick Lambda to be invoked when the button is clicked. * @param modifier Modifier to be applied to the button. * @param text TextReference for the button label. - * @param iconRes Drawable resource ID for the icon to be displayed in the button. + * @param tangemIconUM Icon for the icon to be displayed in the button. * @param iconPosition Position of the icon (Start or End). * @param isEnabled Boolean indicating whether the button is enabled. * @param isLoading Boolean indicating whether the button is in a loading state. @@ -62,7 +62,7 @@ fun OutlineTangemButton( onClick: () -> Unit, modifier: Modifier = Modifier, text: TextReference? = null, - @DrawableRes iconRes: Int? = null, + tangemIconUM: TangemIconUM? = null, iconPosition: TangemButtonIconPosition = TangemButtonIconPosition.Start, isEnabled: Boolean = true, isLoading: Boolean = false, @@ -86,7 +86,7 @@ fun OutlineTangemButton( ), text = text, contentColor = contentColor, - iconRes = iconRes, + tangemIconUM = tangemIconUM, isEnabled = isEnabled, isLoading = isLoading, size = size, @@ -125,7 +125,16 @@ private fun OutlineTangemButton_Preview( size = TangemButtonSize.X15, shape = shape, iconPosition = iconPosition, - iconRes = R.drawable.ic_tangem_24, + tangemIconUM = TangemIconUM.Icon( + iconRes = R.drawable.ic_tangem_24, + tintReference = { + if (isEnabled) { + TangemTheme.colors2.graphic.neutral.primary + } else { + TangemTheme.colors2.graphic.neutral.quaternary + } + }, + ), isEnabled = isEnabled, isLoading = isLoading, ) diff --git a/core/ui/src/main/java/com/tangem/core/ui/ds/button/PrimaryInverseTangemButton.kt b/core/ui/src/main/java/com/tangem/core/ui/ds/button/PrimaryInverseTangemButton.kt index b8bf5c1228..7c7f5e8c7a 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/ds/button/PrimaryInverseTangemButton.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/ds/button/PrimaryInverseTangemButton.kt @@ -1,7 +1,6 @@ package com.tangem.core.ui.ds.button import android.content.res.Configuration -import androidx.annotation.DrawableRes import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -15,6 +14,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.tooling.preview.PreviewParameterProvider import androidx.compose.ui.unit.dp import com.tangem.core.ui.R +import com.tangem.core.ui.ds.image.TangemIconUM import com.tangem.core.ui.extensions.TextReference import com.tangem.core.ui.extensions.stringReference import com.tangem.core.ui.res.TangemTheme @@ -32,7 +32,7 @@ fun PrimaryInverseTangemButton(buttonUM: TangemButtonUM, modifier: Modifier = Mo onClick = buttonUM.onClick, modifier = modifier, text = buttonUM.text, - iconRes = buttonUM.iconRes, + tangemIconUM = buttonUM.tangemIconUM, iconPosition = buttonUM.iconPosition, isEnabled = buttonUM.isEnabled, isLoading = buttonUM.isLoading, @@ -47,7 +47,7 @@ fun PrimaryInverseTangemButton(buttonUM: TangemButtonUM, modifier: Modifier = Mo * @param onClick Lambda to be invoked when the button is clicked. * @param modifier Modifier to be applied to the button. * @param text TextReference for the button label. - * @param iconRes Drawable resource ID for the icon to be displayed in the button. + * @param tangemIconUM Icon for the icon to be displayed in the button. * @param iconPosition Position of the icon (Start or End). * @param isEnabled Boolean indicating whether the button is enabled. * @param isLoading Boolean indicating whether the button is in a loading state. @@ -61,7 +61,7 @@ fun PrimaryInverseTangemButton( onClick: () -> Unit, modifier: Modifier = Modifier, text: TextReference? = null, - @DrawableRes iconRes: Int? = null, + tangemIconUM: TangemIconUM? = null, iconPosition: TangemButtonIconPosition = TangemButtonIconPosition.Start, isEnabled: Boolean = true, isLoading: Boolean = false, @@ -88,7 +88,7 @@ fun PrimaryInverseTangemButton( isLoading = isLoading, size = size, iconPosition = iconPosition, - iconRes = iconRes, + tangemIconUM = tangemIconUM, ) } @@ -123,7 +123,16 @@ private fun PrimaryInverseTangemButton_Preview( size = TangemButtonSize.X15, shape = shape, iconPosition = iconPosition, - iconRes = R.drawable.ic_tangem_24, + tangemIconUM = TangemIconUM.Icon( + iconRes = R.drawable.ic_tangem_24, + tintReference = { + if (isEnabled) { + TangemTheme.colors2.graphic.neutral.primary + } else { + TangemTheme.colors2.graphic.neutral.quaternary + } + }, + ), isEnabled = isEnabled, isLoading = isLoading, ) diff --git a/core/ui/src/main/java/com/tangem/core/ui/ds/button/PrimaryTangemButton.kt b/core/ui/src/main/java/com/tangem/core/ui/ds/button/PrimaryTangemButton.kt index ce45ef3943..51e2a0e7f4 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/ds/button/PrimaryTangemButton.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/ds/button/PrimaryTangemButton.kt @@ -1,7 +1,6 @@ package com.tangem.core.ui.ds.button import android.content.res.Configuration -import androidx.annotation.DrawableRes import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -15,6 +14,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.tooling.preview.PreviewParameterProvider import androidx.compose.ui.unit.dp import com.tangem.core.ui.R +import com.tangem.core.ui.ds.image.TangemIconUM import com.tangem.core.ui.extensions.TextReference import com.tangem.core.ui.extensions.stringReference import com.tangem.core.ui.res.TangemTheme @@ -33,7 +33,7 @@ fun PrimaryTangemButton(buttonUM: TangemButtonUM, modifier: Modifier = Modifier) modifier = modifier, text = buttonUM.text, descriptionText = buttonUM.descriptionText, - iconRes = buttonUM.iconRes, + tangemIconUM = buttonUM.tangemIconUM, iconPosition = buttonUM.iconPosition, isEnabled = buttonUM.isEnabled, isLoading = buttonUM.isLoading, @@ -48,7 +48,7 @@ fun PrimaryTangemButton(buttonUM: TangemButtonUM, modifier: Modifier = Modifier) * @param onClick Lambda to be invoked when the button is clicked. * @param modifier Modifier to be applied to the button. * @param text TextReference for the button label. - * @param iconRes Drawable resource ID for the icon to be displayed in the button. + * @param tangemIconUM Icon for the icon to be displayed in the button. * @param iconPosition Position of the icon (Start or End). * @param isEnabled Boolean indicating whether the button is enabled. * @param isLoading Boolean indicating whether the button is in a loading state. @@ -63,7 +63,7 @@ fun PrimaryTangemButton( modifier: Modifier = Modifier, text: TextReference? = null, descriptionText: TextReference? = null, - @DrawableRes iconRes: Int? = null, + tangemIconUM: TangemIconUM? = null, iconPosition: TangemButtonIconPosition = TangemButtonIconPosition.Start, isEnabled: Boolean = true, isLoading: Boolean = false, @@ -93,7 +93,7 @@ fun PrimaryTangemButton( isLoading = isLoading, size = size, iconPosition = iconPosition, - iconRes = iconRes, + tangemIconUM = tangemIconUM, ) } @@ -123,7 +123,16 @@ private fun PrimaryTangemButton_Preview( size = TangemButtonSize.X15, shape = shape, iconPosition = TangemButtonIconPosition.entries[xIndex], - iconRes = R.drawable.ic_tangem_24, + tangemIconUM = TangemIconUM.Icon( + iconRes = R.drawable.ic_tangem_24, + tintReference = { + if (isEnabled) { + TangemTheme.colors2.graphic.neutral.primaryInverted + } else { + TangemTheme.colors2.graphic.neutral.quaternary + } + }, + ), isEnabled = isEnabled, isLoading = isLoading, ) diff --git a/core/ui/src/main/java/com/tangem/core/ui/ds/button/SecondaryTangemButton.kt b/core/ui/src/main/java/com/tangem/core/ui/ds/button/SecondaryTangemButton.kt index fc8cd14a2d..b6ced0646b 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/ds/button/SecondaryTangemButton.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/ds/button/SecondaryTangemButton.kt @@ -1,7 +1,6 @@ package com.tangem.core.ui.ds.button import android.content.res.Configuration -import androidx.annotation.DrawableRes import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -16,6 +15,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameterProvider import androidx.compose.ui.unit.dp import com.tangem.core.ui.R import com.tangem.core.ui.components.haze.hazeEffectTangem +import com.tangem.core.ui.ds.image.TangemIconUM import com.tangem.core.ui.extensions.TextReference import com.tangem.core.ui.extensions.stringReference import com.tangem.core.ui.res.TangemTheme @@ -33,7 +33,7 @@ fun SecondaryTangemButton(buttonUM: TangemButtonUM, modifier: Modifier = Modifie onClick = buttonUM.onClick, modifier = modifier, text = buttonUM.text, - iconRes = buttonUM.iconRes, + tangemIconUM = buttonUM.tangemIconUM, iconPosition = buttonUM.iconPosition, isEnabled = buttonUM.isEnabled, isLoading = buttonUM.isLoading, @@ -48,7 +48,7 @@ fun SecondaryTangemButton(buttonUM: TangemButtonUM, modifier: Modifier = Modifie * @param onClick Lambda to be invoked when the button is clicked. * @param modifier Modifier to be applied to the button. * @param text TextReference for the button label. - * @param iconRes Drawable resource ID for the icon to be displayed in the button. + * @param tangemIconUM Icon for the icon to be displayed in the button. * @param iconPosition Position of the icon (Start or End). * @param isEnabled Boolean indicating whether the button is enabled. * @param isLoading Boolean indicating whether the button is in a loading state. @@ -62,7 +62,7 @@ fun SecondaryTangemButton( onClick: () -> Unit, modifier: Modifier = Modifier, text: TextReference? = null, - @DrawableRes iconRes: Int? = null, + tangemIconUM: TangemIconUM? = null, iconPosition: TangemButtonIconPosition = TangemButtonIconPosition.Start, isEnabled: Boolean = true, isLoading: Boolean = false, @@ -88,7 +88,7 @@ fun SecondaryTangemButton( .then(backgroundModifier), text = text, contentColor = contentColor, - iconRes = iconRes, + tangemIconUM = tangemIconUM, isEnabled = isEnabled, isLoading = isLoading, size = size, @@ -127,7 +127,16 @@ private fun SecondaryTangemButton_Preview( size = TangemButtonSize.X15, shape = shape, iconPosition = iconPosition, - iconRes = R.drawable.ic_tangem_24, + tangemIconUM = TangemIconUM.Icon( + iconRes = R.drawable.ic_tangem_24, + tintReference = { + if (isEnabled) { + TangemTheme.colors2.graphic.neutral.primary + } else { + TangemTheme.colors2.graphic.neutral.quaternary + } + }, + ), isEnabled = isEnabled, isLoading = isLoading, ) diff --git a/core/ui/src/main/java/com/tangem/core/ui/ds/button/StatusTangemButton.kt b/core/ui/src/main/java/com/tangem/core/ui/ds/button/StatusTangemButton.kt index 7f1fc5b787..3f8301efcc 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/ds/button/StatusTangemButton.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/ds/button/StatusTangemButton.kt @@ -1,7 +1,6 @@ package com.tangem.core.ui.ds.button import android.content.res.Configuration -import androidx.annotation.DrawableRes import androidx.compose.foundation.background import androidx.compose.foundation.layout.* import androidx.compose.runtime.Composable @@ -14,6 +13,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameterProvider import androidx.compose.ui.unit.dp import androidx.compose.ui.util.fastForEach import com.tangem.core.ui.R +import com.tangem.core.ui.ds.image.TangemIconUM import com.tangem.core.ui.extensions.TextReference import com.tangem.core.ui.extensions.stringReference import com.tangem.core.ui.res.TangemTheme @@ -31,7 +31,7 @@ fun StatusTangemButton(buttonUM: TangemButtonUM, modifier: Modifier = Modifier) onClick = buttonUM.onClick, modifier = modifier, text = buttonUM.text, - iconRes = buttonUM.iconRes, + tangemIconUM = buttonUM.tangemIconUM, iconPosition = buttonUM.iconPosition, isEnabled = buttonUM.isEnabled, isLoading = buttonUM.isLoading, @@ -47,7 +47,7 @@ fun StatusTangemButton(buttonUM: TangemButtonUM, modifier: Modifier = Modifier) * @param onClick Lambda to be invoked when the button is clicked. * @param modifier Modifier to be applied to the button. * @param text TextReference for the button label. - * @param iconRes Drawable resource ID for the icon to be displayed in the button. + * @param tangemIconUM Icon for the icon to be displayed in the button. * @param iconPosition Position of the icon (Start or End). * @param isEnabled Boolean indicating whether the button is enabled. * @param isLoading Boolean indicating whether the button is in a loading state. @@ -61,7 +61,7 @@ fun StatusTangemButton( onClick: () -> Unit, modifier: Modifier = Modifier, text: TextReference? = null, - @DrawableRes iconRes: Int? = null, + tangemIconUM: TangemIconUM? = null, iconPosition: TangemButtonIconPosition = TangemButtonIconPosition.Start, isEnabled: Boolean = true, isLoading: Boolean = false, @@ -85,7 +85,7 @@ fun StatusTangemButton( .then(backgroundModifier), text = text, contentColor = contentColor, - iconRes = iconRes, + tangemIconUM = tangemIconUM, isEnabled = isEnabled, isLoading = isLoading, size = size, @@ -135,7 +135,16 @@ private fun StatusTangemButton_Preview( size = TangemButtonSize.X15, shape = shape, iconPosition = iconPosition, - iconRes = R.drawable.ic_tangem_24, + tangemIconUM = TangemIconUM.Icon( + iconRes = R.drawable.ic_tangem_24, + tintReference = { + if (isEnabled) { + TangemTheme.colors2.graphic.neutral.primaryInvertedConstant + } else { + TangemTheme.colors2.graphic.neutral.quaternary + } + }, + ), type = params.type, isEnabled = isEnabled, isLoading = isLoading, diff --git a/core/ui/src/main/java/com/tangem/core/ui/ds/button/TangemButton.kt b/core/ui/src/main/java/com/tangem/core/ui/ds/button/TangemButton.kt index cd5fe7858f..60ac1aebea 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/ds/button/TangemButton.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/ds/button/TangemButton.kt @@ -21,7 +21,7 @@ fun TangemButton(buttonUM: TangemButtonUM, modifier: Modifier = Modifier) { modifier = modifier, text = buttonUM.text, descriptionText = buttonUM.descriptionText, - iconRes = buttonUM.iconRes, + tangemIconUM = buttonUM.tangemIconUM, iconPosition = buttonUM.iconPosition, isEnabled = buttonUM.isEnabled, isLoading = buttonUM.isLoading, @@ -32,7 +32,7 @@ fun TangemButton(buttonUM: TangemButtonUM, modifier: Modifier = Modifier) { onClick = buttonUM.onClick, modifier = modifier, text = buttonUM.text, - iconRes = buttonUM.iconRes, + tangemIconUM = buttonUM.tangemIconUM, iconPosition = buttonUM.iconPosition, isEnabled = buttonUM.isEnabled, isLoading = buttonUM.isLoading, @@ -43,7 +43,7 @@ fun TangemButton(buttonUM: TangemButtonUM, modifier: Modifier = Modifier) { onClick = buttonUM.onClick, modifier = modifier, text = buttonUM.text, - iconRes = buttonUM.iconRes, + tangemIconUM = buttonUM.tangemIconUM, iconPosition = buttonUM.iconPosition, isEnabled = buttonUM.isEnabled, isLoading = buttonUM.isLoading, @@ -55,7 +55,7 @@ fun TangemButton(buttonUM: TangemButtonUM, modifier: Modifier = Modifier) { onClick = buttonUM.onClick, modifier = modifier, text = buttonUM.text, - iconRes = buttonUM.iconRes, + tangemIconUM = buttonUM.tangemIconUM, iconPosition = buttonUM.iconPosition, isEnabled = buttonUM.isEnabled, isLoading = buttonUM.isLoading, @@ -67,7 +67,7 @@ fun TangemButton(buttonUM: TangemButtonUM, modifier: Modifier = Modifier) { onClick = buttonUM.onClick, modifier = modifier, text = buttonUM.text, - iconRes = buttonUM.iconRes, + tangemIconUM = buttonUM.tangemIconUM, iconPosition = buttonUM.iconPosition, isEnabled = buttonUM.isEnabled, isLoading = buttonUM.isLoading, @@ -78,7 +78,7 @@ fun TangemButton(buttonUM: TangemButtonUM, modifier: Modifier = Modifier) { onClick = buttonUM.onClick, modifier = modifier, text = buttonUM.text, - iconRes = buttonUM.iconRes, + tangemIconUM = buttonUM.tangemIconUM, iconPosition = buttonUM.iconPosition, isEnabled = buttonUM.isEnabled, isLoading = buttonUM.isLoading, @@ -89,7 +89,7 @@ fun TangemButton(buttonUM: TangemButtonUM, modifier: Modifier = Modifier) { onClick = buttonUM.onClick, modifier = modifier, text = buttonUM.text, - iconRes = buttonUM.iconRes, + tangemIconUM = buttonUM.tangemIconUM, iconPosition = buttonUM.iconPosition, isEnabled = buttonUM.isEnabled, isLoading = buttonUM.isLoading, diff --git a/core/ui/src/main/java/com/tangem/core/ui/ds/button/TangemButtonInternal.kt b/core/ui/src/main/java/com/tangem/core/ui/ds/button/TangemButtonInternal.kt index dc5221c182..f1abe125cf 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/ds/button/TangemButtonInternal.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/ds/button/TangemButtonInternal.kt @@ -1,6 +1,5 @@ package com.tangem.core.ui.ds.button -import androidx.annotation.DrawableRes import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.animateContentSize import androidx.compose.animation.core.tween @@ -10,7 +9,10 @@ import androidx.compose.foundation.layout.* import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.text.TextAutoSize import androidx.compose.material.ripple.RippleAlpha -import androidx.compose.material3.* +import androidx.compose.material3.CircularProgressIndicator +import androidx.compose.material3.LocalRippleConfiguration +import androidx.compose.material3.RippleConfiguration +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.ReadOnlyComposable @@ -21,7 +23,6 @@ import androidx.compose.ui.draw.alpha import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.StrokeCap import androidx.compose.ui.platform.testTag -import androidx.compose.ui.res.painterResource import androidx.compose.ui.semantics.Role import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.style.TextAlign @@ -29,6 +30,8 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.tangem.core.ui.components.SpacerW +import com.tangem.core.ui.ds.image.TangemIcon +import com.tangem.core.ui.ds.image.TangemIconUM import com.tangem.core.ui.extensions.* import com.tangem.core.ui.res.TangemTheme import com.tangem.core.ui.test.BaseButtonTestTags @@ -41,12 +44,12 @@ private const val LOADING_ANIMATION_DURATION = 150 * @param onClick Lambda to be invoked when the button is clicked. * @param modifier Modifier to be applied to the button. * @param text TextReference for the button label. - * @param iconRes Drawable resource ID for the icon to be displayed in the button. + * @param tangemIconUM Icon for the icon to be displayed in the button. * @param iconPosition Position of the icon (Start or End). * @param isEnabled Boolean indicating whether the button is enabled. * @param isLoading Boolean indicating whether the button is in a loading state. * @param hasPadding Boolean indicating whether the button should have padding around its content. - * @param contentColor Color of the button content (text and icon). + * @param contentColor Color of the button content (text). * @param size TangemButtonSize defining the size of the button. * [REDACTED_AUTHOR] @@ -57,7 +60,7 @@ internal fun TangemButtonInternal( modifier: Modifier = Modifier, text: TextReference? = null, descriptionText: TextReference? = null, - @DrawableRes iconRes: Int? = null, + tangemIconUM: TangemIconUM? = null, iconPosition: TangemButtonIconPosition = TangemButtonIconPosition.Start, isEnabled: Boolean = true, isLoading: Boolean = false, @@ -87,10 +90,9 @@ internal fun TangemButtonInternal( alpha(0f) }, ) { - val isStartIcon = iconRes != null && iconPosition == TangemButtonIconPosition.Start + val isStartIcon = tangemIconUM != null && iconPosition == TangemButtonIconPosition.Start TangemButtonIcon( - iconRes = iconRes, - iconColor = contentColor, + tangemIconUM = tangemIconUM, isVisible = isStartIcon, size = size, ) @@ -105,13 +107,12 @@ internal fun TangemButtonInternal( size = size, ) - val isEndIcon = iconRes != null && iconPosition == TangemButtonIconPosition.End + val isEndIcon = tangemIconUM != null && iconPosition == TangemButtonIconPosition.End if (isEndIcon && (text != null || descriptionText != null)) { SpacerW(TangemTheme.dimens2.x1) } TangemButtonIcon( - iconRes = iconRes, - iconColor = contentColor, + tangemIconUM = tangemIconUM, isVisible = isEndIcon, size = size, ) @@ -198,22 +199,13 @@ private inline fun ProvideButtonRippleConfiguration(crossinline content: @Compos } @Composable -private fun TangemButtonIcon( - @DrawableRes iconRes: Int?, - iconColor: Color, - isVisible: Boolean, - size: TangemButtonSize, -) { +private fun TangemButtonIcon(tangemIconUM: TangemIconUM?, isVisible: Boolean, size: TangemButtonSize) { AnimatedVisibility( visible = isVisible, modifier = Modifier.size(size = size.toContentSize()), ) { - val wrappedIconRes = remember(iconRes) { requireNotNull(iconRes) } - Icon( - painter = painterResource(id = wrappedIconRes), - contentDescription = null, - tint = iconColor, - ) + val wrappedIconUM = remember(tangemIconUM) { requireNotNull(tangemIconUM) } + TangemIcon(tangemIconUM = wrappedIconUM) } } diff --git a/core/ui/src/main/java/com/tangem/core/ui/ds/button/TangemButtonUM.kt b/core/ui/src/main/java/com/tangem/core/ui/ds/button/TangemButtonUM.kt index 029a4d3111..04c7a63e72 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/ds/button/TangemButtonUM.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/ds/button/TangemButtonUM.kt @@ -1,7 +1,7 @@ package com.tangem.core.ui.ds.button -import androidx.annotation.DrawableRes import androidx.compose.runtime.Stable +import com.tangem.core.ui.ds.image.TangemIconUM import com.tangem.core.ui.extensions.TextReference /** @@ -9,7 +9,7 @@ import com.tangem.core.ui.extensions.TextReference * * @param text TextReference for the button label. * @param descriptionText TextReference for the button description (optional). - * @param iconRes Drawable resource ID for the icon to be displayed in the button (optional). + * @param tangemIconUM Icon for the icon to be displayed in the button (optional). * @param iconPosition Position of the icon (Start or End). * @param isEnabled Boolean indicating whether the button is enabled. * @param isLoading Boolean indicating whether the button is in a loading state. @@ -24,7 +24,7 @@ import com.tangem.core.ui.extensions.TextReference data class TangemButtonUM( val text: TextReference? = null, val descriptionText: TextReference? = null, - @DrawableRes val iconRes: Int? = null, + val tangemIconUM: TangemIconUM? = null, val iconPosition: TangemButtonIconPosition = TangemButtonIconPosition.Start, val isEnabled: Boolean = true, val isLoading: Boolean = false, diff --git a/core/ui/src/main/java/com/tangem/core/ui/ds/message/TangemMessage.kt b/core/ui/src/main/java/com/tangem/core/ui/ds/message/TangemMessage.kt index e11afd6121..ea6a935256 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/ds/message/TangemMessage.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/ds/message/TangemMessage.kt @@ -259,13 +259,19 @@ private fun TangemMessageContent( } } +@Suppress("LongMethod") @Composable private fun RowScope.TangemMessageLegacyButtons(buttonState: ButtonsState) { when (buttonState) { is ButtonsState.PrimaryButtonConfig -> PrimaryTangemButton( text = buttonState.text, descriptionText = buttonState.additionalText, - iconRes = buttonState.iconResId, + tangemIconUM = buttonState.iconResId?.let { + TangemIconUM.Icon( + iconRes = buttonState.iconResId, + tintReference = { TangemTheme.colors2.graphic.neutral.primary }, + ) + }, onClick = buttonState.onClick, iconPosition = TangemButtonIconPosition.End, shape = TangemButtonShape.Rounded, @@ -275,7 +281,12 @@ private fun RowScope.TangemMessageLegacyButtons(buttonState: ButtonsState) { ) is ButtonsState.SecondaryButtonConfig -> PrimaryInverseTangemButton( text = buttonState.text, - iconRes = buttonState.iconResId, + tangemIconUM = buttonState.iconResId?.let { + TangemIconUM.Icon( + iconRes = buttonState.iconResId, + tintReference = { TangemTheme.colors2.graphic.neutral.primary }, + ) + }, onClick = buttonState.onClick, iconPosition = TangemButtonIconPosition.End, shape = TangemButtonShape.Rounded, @@ -362,7 +373,10 @@ private class TangemMessagePreviewProvider : PreviewParameterProvider Unit, ) { @@ -57,7 +56,7 @@ data class TangemMessageButtonUM( text = text, size = TangemButtonSize.X9, shape = TangemButtonShape.Rounded, - iconRes = iconRes, + tangemIconUM = tangemIconUM, iconPosition = TangemButtonIconPosition.End, type = type, isLoading = isLoading, diff --git a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/earn/components/FilterButtons.kt b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/earn/components/FilterButtons.kt index f957da7fda..ad1a4bae06 100644 --- a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/earn/components/FilterButtons.kt +++ b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/earn/components/FilterButtons.kt @@ -13,8 +13,10 @@ import com.tangem.core.ui.components.buttons.common.TangemButtonIconPosition import com.tangem.core.ui.ds.button.PrimaryInverseTangemButton import com.tangem.core.ui.ds.button.TangemButtonShape import com.tangem.core.ui.ds.button.TangemButtonSize +import com.tangem.core.ui.ds.image.TangemIconUM import com.tangem.core.ui.extensions.TextReference import com.tangem.core.ui.res.LocalRedesignEnabled +import com.tangem.core.ui.res.TangemTheme import com.tangem.features.feed.ui.earn.state.EarnFilterNetworkUM import com.tangem.features.feed.ui.earn.state.EarnFilterUM @@ -93,7 +95,16 @@ private fun FilterButtonsV2( is EarnFilterNetworkUM.Network -> TextReference.Str(earnFilterUM.selectedNetworkFilter.text) }, onClick = onNetworkFilterClick, - iconRes = R.drawable.ic_chewron_down_20, + tangemIconUM = TangemIconUM.Icon( + iconRes = R.drawable.ic_chewron_down_20, + tintReference = { + if (earnFilterUM.isNetworkFilterEnabled) { + TangemTheme.colors2.graphic.neutral.primary + } else { + TangemTheme.colors2.graphic.neutral.quaternary + } + }, + ), iconPosition = com.tangem.core.ui.ds.button.TangemButtonIconPosition.End, size = TangemButtonSize.X9, shape = TangemButtonShape.Rounded, @@ -105,7 +116,16 @@ private fun FilterButtonsV2( PrimaryInverseTangemButton( text = earnFilterUM.selectedTypeFilter.text, onClick = onTypeFilterClick, - iconRes = R.drawable.ic_chewron_down_20, + tangemIconUM = TangemIconUM.Icon( + iconRes = R.drawable.ic_chewron_down_20, + tintReference = { + if (earnFilterUM.isTypeFilterEnabled) { + TangemTheme.colors2.graphic.neutral.primary + } else { + TangemTheme.colors2.graphic.neutral.quaternary + } + }, + ), iconPosition = com.tangem.core.ui.ds.button.TangemButtonIconPosition.End, size = TangemButtonSize.X9, shape = TangemButtonShape.Rounded, diff --git a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/market/list/components/Options.kt b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/market/list/components/Options.kt index c8e073eb9c..5dc049b114 100644 --- a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/market/list/components/Options.kt +++ b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/market/list/components/Options.kt @@ -15,6 +15,7 @@ import com.tangem.core.ui.components.haze.hazeEffectTangem import com.tangem.core.ui.ds.button.PrimaryInverseTangemButton import com.tangem.core.ui.ds.button.TangemButtonShape import com.tangem.core.ui.ds.button.TangemButtonSize +import com.tangem.core.ui.ds.image.TangemIconUM import com.tangem.core.ui.ds.tabs.TangemSegmentUM import com.tangem.core.ui.ds.tabs.TangemSegmentedPicker import com.tangem.core.ui.extensions.resolveReference @@ -149,7 +150,10 @@ private fun OptionsV2( isShowDropdownMenu = true }, iconPosition = RedesignTangemButtonIconPosition.End, - iconRes = R.drawable.ic_chewron_down_20, + tangemIconUM = TangemIconUM.Icon( + iconRes = R.drawable.ic_chewron_down_20, + tintReference = { TangemTheme.colors2.graphic.neutral.primary }, + ), text = sortMenuUM.selectedOption.text, size = TangemButtonSize.X9, shape = TangemButtonShape.Rounded, diff --git a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/news/details/components/ArticleDetail.kt b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/news/details/components/ArticleDetail.kt index 7c7c47c46d..4b9ac978b3 100644 --- a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/news/details/components/ArticleDetail.kt +++ b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/news/details/components/ArticleDetail.kt @@ -26,6 +26,7 @@ import com.tangem.core.ui.components.buttons.common.TangemButtonSize import com.tangem.core.ui.components.haze.hazeSourceTangem import com.tangem.core.ui.ds.button.SecondaryTangemButton import com.tangem.core.ui.ds.button.TangemButtonShape +import com.tangem.core.ui.ds.image.TangemIconUM import com.tangem.core.ui.extensions.resolveReference import com.tangem.core.ui.extensions.resourceReference import com.tangem.core.ui.extensions.stringResourceSafe @@ -261,10 +262,16 @@ internal fun ArticleDetailV2( modifier = Modifier.padding(horizontal = 24.dp), text = resourceReference(R.string.news_like), size = com.tangem.core.ui.ds.button.TangemButtonSize.X9, - iconRes = if (article.isLiked) { - R.drawable.ic_like_20 + tangemIconUM = if (article.isLiked) { + TangemIconUM.Icon( + iconRes = R.drawable.ic_heart_filled_20, + tintReference = { TangemTheme.colors2.markers.iconRed }, + ) } else { - R.drawable.ic_heart_20 + TangemIconUM.Icon( + iconRes = R.drawable.ic_heart_20, + tintReference = { TangemTheme.colors2.button.iconPrimary }, + ) }, onClick = { hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress) diff --git a/features/tester/impl/src/main/java/com/tangem/feature/tester/presentation/storybook/page/buttons/ButtonsStory.kt b/features/tester/impl/src/main/java/com/tangem/feature/tester/presentation/storybook/page/buttons/ButtonsStory.kt index 5c46b2587c..d1bd85a0e6 100644 --- a/features/tester/impl/src/main/java/com/tangem/feature/tester/presentation/storybook/page/buttons/ButtonsStory.kt +++ b/features/tester/impl/src/main/java/com/tangem/feature/tester/presentation/storybook/page/buttons/ButtonsStory.kt @@ -14,12 +14,13 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import com.tangem.core.ui.R import com.tangem.core.ui.ds.button.* +import com.tangem.core.ui.ds.image.TangemIconUM import com.tangem.core.ui.extensions.stringReference import com.tangem.core.ui.res.TangemTheme private const val STATE_LABEL_WIDTH = 80 -@Suppress("LongMethod") +@Suppress("LongMethod", "CyclomaticComplexMethod") @Composable internal fun ButtonsStory(modifier: Modifier = Modifier) { LazyColumn( @@ -35,7 +36,16 @@ internal fun ButtonsStory(modifier: Modifier = Modifier) { PrimaryTangemButton( onClick = {}, text = if (text) stringReference("Continue") else null, - iconRes = R.drawable.ic_tangem_24, + tangemIconUM = TangemIconUM.Icon( + iconRes = R.drawable.ic_tangem_24, + tintReference = { + if (isEnabled) { + TangemTheme.colors2.graphic.neutral.primaryInverted + } else { + TangemTheme.colors2.graphic.neutral.quaternary + } + }, + ), size = TangemButtonSize.X10, isEnabled = isEnabled, shape = shape, @@ -47,7 +57,16 @@ internal fun ButtonsStory(modifier: Modifier = Modifier) { SecondaryTangemButton( onClick = {}, text = if (text) stringReference("Continue") else null, - iconRes = R.drawable.ic_tangem_24, + tangemIconUM = TangemIconUM.Icon( + iconRes = R.drawable.ic_tangem_24, + tintReference = { + if (isEnabled) { + TangemTheme.colors2.graphic.neutral.primary + } else { + TangemTheme.colors2.graphic.neutral.quaternary + } + }, + ), size = TangemButtonSize.X10, isEnabled = isEnabled, shape = shape, @@ -62,7 +81,16 @@ internal fun ButtonsStory(modifier: Modifier = Modifier) { PrimaryInverseTangemButton( onClick = {}, text = if (text) stringReference("Continue") else null, - iconRes = R.drawable.ic_tangem_24, + tangemIconUM = TangemIconUM.Icon( + iconRes = R.drawable.ic_tangem_24, + tintReference = { + if (isEnabled) { + TangemTheme.colors2.graphic.neutral.primary + } else { + TangemTheme.colors2.graphic.neutral.quaternary + } + }, + ), size = TangemButtonSize.X10, isEnabled = isEnabled, shape = shape, @@ -74,7 +102,16 @@ internal fun ButtonsStory(modifier: Modifier = Modifier) { OutlineTangemButton( onClick = {}, text = if (text) stringReference("Continue") else null, - iconRes = R.drawable.ic_tangem_24, + tangemIconUM = TangemIconUM.Icon( + iconRes = R.drawable.ic_tangem_24, + tintReference = { + if (isEnabled) { + TangemTheme.colors2.graphic.neutral.primary + } else { + TangemTheme.colors2.graphic.neutral.quaternary + } + }, + ), size = TangemButtonSize.X10, isEnabled = isEnabled, shape = shape, @@ -86,7 +123,16 @@ internal fun ButtonsStory(modifier: Modifier = Modifier) { StatusTangemButton( onClick = {}, text = if (text) stringReference("Continue") else null, - iconRes = R.drawable.ic_tangem_24, + tangemIconUM = TangemIconUM.Icon( + iconRes = R.drawable.ic_tangem_24, + tintReference = { + if (isEnabled) { + TangemTheme.colors2.graphic.neutral.primaryInvertedConstant + } else { + TangemTheme.colors2.graphic.neutral.quaternary + } + }, + ), size = TangemButtonSize.X10, isEnabled = isEnabled, shape = shape, @@ -98,7 +144,16 @@ internal fun ButtonsStory(modifier: Modifier = Modifier) { StatusTangemButton( onClick = {}, text = if (text) stringReference("Continue") else null, - iconRes = R.drawable.ic_tangem_24, + tangemIconUM = TangemIconUM.Icon( + iconRes = R.drawable.ic_tangem_24, + tintReference = { + if (isEnabled) { + TangemTheme.colors2.graphic.neutral.primaryInverted + } else { + TangemTheme.colors2.graphic.neutral.quaternary + } + }, + ), size = TangemButtonSize.X10, type = TangemButtonType.Positive, isEnabled = isEnabled, @@ -111,7 +166,16 @@ internal fun ButtonsStory(modifier: Modifier = Modifier) { GhostTangemButton( onClick = {}, text = if (text) stringReference("Continue") else null, - iconRes = R.drawable.ic_tangem_24, + tangemIconUM = TangemIconUM.Icon( + iconRes = R.drawable.ic_tangem_24, + tintReference = { + if (isEnabled) { + TangemTheme.colors2.graphic.neutral.primary + } else { + TangemTheme.colors2.graphic.neutral.quaternary + } + }, + ), size = TangemButtonSize.X10, isEnabled = isEnabled, shape = shape, diff --git a/features/tester/impl/src/main/java/com/tangem/feature/tester/presentation/storybook/page/message/TangemMessageStory.kt b/features/tester/impl/src/main/java/com/tangem/feature/tester/presentation/storybook/page/message/TangemMessageStory.kt index 8ee2be7006..c1bea7c014 100644 --- a/features/tester/impl/src/main/java/com/tangem/feature/tester/presentation/storybook/page/message/TangemMessageStory.kt +++ b/features/tester/impl/src/main/java/com/tangem/feature/tester/presentation/storybook/page/message/TangemMessageStory.kt @@ -105,7 +105,10 @@ internal fun TangemMessageStory(state: TangemMessageStory, modifier: Modifier = TangemMessageButtonUM( text = stringReference("Generate"), type = TangemButtonType.Primary, - iconRes = R.drawable.ic_tangem_24, + tangemIconUM = TangemIconUM.Icon( + iconRes = R.drawable.ic_tangem_24, + tintReference = { TangemTheme.colors2.graphic.neutral.primary }, + ), onClick = {}, ), ), diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/common/preview/WalletScreenPreviewData.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/common/preview/WalletScreenPreviewData.kt index a752af09d7..b98fa31b13 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/common/preview/WalletScreenPreviewData.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/common/preview/WalletScreenPreviewData.kt @@ -12,6 +12,7 @@ import com.tangem.core.ui.ds.row.token.TangemTokenRowUM import com.tangem.core.ui.event.consumedEvent import com.tangem.core.ui.extensions.resourceReference import com.tangem.core.ui.extensions.stringReference +import com.tangem.core.ui.res.TangemTheme import com.tangem.feature.wallet.impl.R import com.tangem.feature.wallet.presentation.common.WalletPreviewDataLegacy.topBarConfig import com.tangem.feature.wallet.presentation.preview.WalletBalancePreview @@ -74,7 +75,10 @@ internal object WalletScreenPreviewData { text = resourceReference(R.string.organize_tokens_title), type = TangemButtonType.Secondary, onClick = {}, - iconRes = R.drawable.ic_filter_default_24, + tangemIconUM = TangemIconUM.Icon( + iconRes = R.drawable.ic_filter_default_24, + tintReference = { TangemTheme.colors2.graphic.neutral.primaryInverted }, + ), size = TangemButtonSize.X9, shape = TangemButtonShape.Rounded, ), @@ -107,7 +111,10 @@ internal object WalletScreenPreviewData { text = resourceReference(R.string.organize_tokens_title), type = TangemButtonType.Secondary, onClick = {}, - iconRes = R.drawable.ic_filter_default_24, + tangemIconUM = TangemIconUM.Icon( + iconRes = R.drawable.ic_filter_default_24, + tintReference = { TangemTheme.colors2.graphic.neutral.primaryInverted }, + ), size = TangemButtonSize.X9, shape = TangemButtonShape.Rounded, ), @@ -134,7 +141,10 @@ internal object WalletScreenPreviewData { text = resourceReference(R.string.organize_tokens_title), type = TangemButtonType.Secondary, onClick = {}, - iconRes = R.drawable.ic_filter_default_24, + tangemIconUM = TangemIconUM.Icon( + iconRes = R.drawable.ic_filter_default_24, + tintReference = { TangemTheme.colors2.graphic.neutral.primaryInverted }, + ), size = TangemButtonSize.X9, shape = TangemButtonShape.Rounded, ), diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/WalletActionButtons.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/WalletActionButtons.kt index 5f463a795d..254ac41d1e 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/WalletActionButtons.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/WalletActionButtons.kt @@ -5,8 +5,10 @@ import androidx.compose.runtime.Immutable import com.tangem.core.ui.ds.button.TangemButtonShape import com.tangem.core.ui.ds.button.TangemButtonType import com.tangem.core.ui.ds.button.TangemButtonUM +import com.tangem.core.ui.ds.image.TangemIconUM import com.tangem.core.ui.extensions.TextReference import com.tangem.core.ui.extensions.resourceReference +import com.tangem.core.ui.res.TangemTheme import com.tangem.feature.wallet.impl.R /** @@ -25,7 +27,16 @@ internal sealed class WalletActionButtons( val buttonUM: TangemButtonUM get() = TangemButtonUM( text = text, - iconRes = iconRes, + tangemIconUM = TangemIconUM.Icon( + iconRes = iconRes, + tintReference = { + if (isEnabled) { + TangemTheme.colors2.graphic.neutral.primary + } else { + TangemTheme.colors2.graphic.neutral.quaternary + } + }, + ), type = TangemButtonType.Secondary, shape = TangemButtonShape.Rounded, onClick = onClick, diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/WalletNotificationUM.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/WalletNotificationUM.kt index fdefd1e7bf..f33fa5a3a0 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/WalletNotificationUM.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/WalletNotificationUM.kt @@ -251,7 +251,12 @@ internal sealed class WalletNotificationUM(val messageUM: TangemMessageUM, val t TangemMessageButtonUM( text = resourceReference(id = R.string.common_generate_addresses), type = TangemButtonType.Primary, - iconRes = tangemIcon, + tangemIconUM = tangemIcon?.let { + TangemIconUM.Icon( + iconRes = tangemIcon, + tintReference = { TangemTheme.colors2.graphic.neutral.primaryInverted }, + ) + }, onClick = onGenerateClick, ), ), @@ -307,7 +312,10 @@ internal sealed class WalletNotificationUM(val messageUM: TangemMessageUM, val t buttonsUM = persistentListOf( TangemMessageButtonUM( text = buttonText, - iconRes = R.drawable.ic_tangem_24, + tangemIconUM = TangemIconUM.Icon( + iconRes = R.drawable.ic_tangem_24, + tintReference = { TangemTheme.colors2.graphic.neutral.primaryInverted }, + ), onClick = onRefreshClick, type = TangemButtonType.Primary, isLoading = shouldShowProgress, diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/WalletTokensListUMConverter.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/WalletTokensListUMConverter.kt index 58e67d0012..c252326e14 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/WalletTokensListUMConverter.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/WalletTokensListUMConverter.kt @@ -4,9 +4,11 @@ import com.tangem.core.ui.ds.button.TangemButtonShape import com.tangem.core.ui.ds.button.TangemButtonSize import com.tangem.core.ui.ds.button.TangemButtonType import com.tangem.core.ui.ds.button.TangemButtonUM +import com.tangem.core.ui.ds.image.TangemIconUM import com.tangem.core.ui.ds.row.header.TangemHeaderRowUM import com.tangem.core.ui.extensions.resourceReference import com.tangem.core.ui.extensions.wrappedList +import com.tangem.core.ui.res.TangemTheme import com.tangem.domain.account.models.AccountStatusList import com.tangem.domain.appcurrency.model.AppCurrency import com.tangem.domain.models.TotalFiatBalance @@ -169,7 +171,16 @@ internal class WalletTokensListUMConverter( size = TangemButtonSize.X9, shape = TangemButtonShape.Rounded, type = TangemButtonType.PrimaryInverse, - iconRes = R.drawable.ic_filter_default_24, + tangemIconUM = TangemIconUM.Icon( + iconRes = R.drawable.ic_filter_default_24, + tintReference = { + if (accountList.totalFiatBalance !is TotalFiatBalance.Loading) { + TangemTheme.colors2.graphic.neutral.primary + } else { + TangemTheme.colors2.graphic.neutral.quaternary + } + }, + ), onClick = clickIntents::onOrganizeTokensClick, ) } else { diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/common/WalletBalance.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/common/WalletBalance.kt index 55367e4bff..41663f384a 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/common/WalletBalance.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/common/WalletBalance.kt @@ -171,7 +171,7 @@ private fun ActionButtons(buttons: ImmutableList) { horizontalAlignment = Alignment.CenterHorizontally, ) { SecondaryTangemButton( - iconRes = button.iconRes, + tangemIconUM = button.tangemIconUM, onClick = button.onClick, isEnabled = button.isEnabled, shape = TangemButtonShape.Rounded,