From 5b282452e7dc00ff223faeb9ad52778479c24b8b Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 14 Dec 2023 20:52:42 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../NotificationWithBackground.kt | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/notifications/NotificationWithBackground.kt b/core/ui/src/main/java/com/tangem/core/ui/components/notifications/NotificationWithBackground.kt index b377102b35..691cded7ba 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/notifications/NotificationWithBackground.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/notifications/NotificationWithBackground.kt @@ -22,10 +22,15 @@ import androidx.constraintlayout.compose.ConstraintLayout import androidx.constraintlayout.compose.Dimension import androidx.constraintlayout.compose.Visibility import com.tangem.core.ui.R -import com.tangem.core.ui.components.SecondaryButtonIconStart +import com.tangem.core.ui.components.buttons.common.TangemButton +import com.tangem.core.ui.components.buttons.common.TangemButtonColors +import com.tangem.core.ui.components.buttons.common.TangemButtonIconPosition 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.LocalIsInDarkTheme +import com.tangem.core.ui.res.TangemColorPalette.Dark6 +import com.tangem.core.ui.res.TangemColorPalette.Light4 import com.tangem.core.ui.res.TangemTheme /** @@ -113,10 +118,19 @@ fun NotificationWithBackground(config: NotificationConfig, modifier: Modifier = config.onCloseClick?.invoke() }, ) - SecondaryButtonIconStart( + val isDarkMode = LocalIsInDarkTheme.current + TangemButton( text = button?.text?.resolveReference().orEmpty(), - iconResId = button?.iconResId ?: R.drawable.ic_exchange_vertical_24, + icon = TangemButtonIconPosition.Start(button?.iconResId ?: R.drawable.ic_exchange_vertical_24), onClick = button?.onClick ?: {}, + colors = TangemButtonColors( + backgroundColor = if (isDarkMode) Light4 else TangemTheme.colors.button.secondary, + contentColor = Dark6, + disabledBackgroundColor = TangemTheme.colors.button.disabled, + disabledContentColor = TangemTheme.colors.text.disabled, + ), + enabled = true, + showProgress = false, modifier = Modifier.constrainAs(buttonRef) { start.linkTo(parent.start, spacing12) end.linkTo(parent.end, spacing12) @@ -135,7 +149,7 @@ fun NotificationWithBackground(config: NotificationConfig, modifier: Modifier = //region preview @Preview @Composable -private fun NotificationWithBackgroundPreview( +private fun NotificationWithBackgroundPreview_Light( @PreviewParameter(NotificationWithBackgroundPreviewProvider::class) config: NotificationConfig, ) { TangemTheme { @@ -143,6 +157,16 @@ private fun NotificationWithBackgroundPreview( } } +@Preview +@Composable +private fun NotificationWithBackgroundPreview_Dark( + @PreviewParameter(NotificationWithBackgroundPreviewProvider::class) config: NotificationConfig, +) { + TangemTheme(isDark = true) { + NotificationWithBackground(config = config) + } +} + private class NotificationWithBackgroundPreviewProvider : PreviewParameterProvider { override val values: Sequence get() = sequenceOf(