Updated on 2026-08-14

This commit is contained in:
Tangem 2026-07-17 12:49:55 +04:00
parent 7f4454c8d2
commit 98d0d9c75e
39 changed files with 266 additions and 3536 deletions

View file

@ -20,12 +20,10 @@ import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.util.lerp
import com.tangem.core.ui.components.SpacerH8
import com.tangem.core.ui.components.notifications.Notification
import com.tangem.core.ui.components.notifications.NotificationConfig
import com.tangem.core.ui.components.pager.PagerIndicator
import com.tangem.core.ui.ds.message.TangemMessage
import com.tangem.core.ui.extensions.stringReference
import com.tangem.core.ui.res.LocalRedesignEnabled
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview
import com.tangem.core.ui.res.TangemThemePreviewRedesign
@ -67,41 +65,23 @@ internal fun PromoBannersBlock(state: PromoBannersBlockUM, horizontalItemPadding
}
@Composable
private fun bannerContainerColor(placeholder: Placeholder): Color = if (LocalRedesignEnabled.current) {
when (placeholder) {
Placeholder.MAIN -> TangemTheme.colors2.surface.level1
Placeholder.FEED -> TangemTheme.colors2.surface.level3
Placeholder.PAYMENT_ACCOUNT_MAIN -> TangemTheme.colors3.bg.opaque.primary
}
} else {
when (placeholder) {
Placeholder.MAIN,
Placeholder.PAYMENT_ACCOUNT_MAIN,
-> TangemTheme.colors.background.primary
Placeholder.FEED -> TangemTheme.colors.background.action
}
private fun bannerContainerColor(placeholder: Placeholder): Color = when (placeholder) {
Placeholder.MAIN -> TangemTheme.colors2.surface.level1
Placeholder.FEED -> TangemTheme.colors2.surface.level3
Placeholder.PAYMENT_ACCOUNT_MAIN -> TangemTheme.colors3.bg.opaque.primary
}
/**
* Renders a banner either with the redesigned [TangemMessage] component or the legacy [Notification],
* depending on [LocalRedesignEnabled]. Both accept the same [NotificationConfig], so the banner model
* and converters stay untouched.
* Renders a banner with the [TangemMessage] component. Uses the same [NotificationConfig] as the banner
* model and converters, so they stay untouched.
*/
@Composable
private fun BannerNotification(config: NotificationConfig, containerColor: Color, modifier: Modifier = Modifier) {
if (LocalRedesignEnabled.current) {
TangemMessage(
config = config,
modifier = modifier.fillMaxWidth(),
contentColor = containerColor,
)
} else {
Notification(
config = config,
modifier = modifier.fillMaxWidth(),
containerColor = containerColor,
)
}
TangemMessage(
config = config,
modifier = modifier.fillMaxWidth(),
contentColor = containerColor,
)
}
@Composable