From 58219439afca9838c0e6d1ea006508555cf7f232 Mon Sep 17 00:00:00 2001 From: PraveenKumar yeruva Date: Mon, 16 Oct 2023 18:39:26 +0530 Subject: [PATCH] adding dismissicon token for card nudge (#532) * adding icon drawable support to card Nudge * seperatring tokens from leading icon and dismiss icon * reverting drawable changes * removing unnecessary strings * accentIcon tint update --------- Co-authored-by: PraveenKumar --- .../theme/token/controlTokens/CardNudgeTokens.kt | 9 +++++++-- .../fluentui/tokenized/notification/CardNudge.kt | 10 +++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/fluentui_core/src/main/java/com/microsoft/fluentui/theme/token/controlTokens/CardNudgeTokens.kt b/fluentui_core/src/main/java/com/microsoft/fluentui/theme/token/controlTokens/CardNudgeTokens.kt index d8dd9f5b3..ff4cae562 100644 --- a/fluentui_core/src/main/java/com/microsoft/fluentui/theme/token/controlTokens/CardNudgeTokens.kt +++ b/fluentui_core/src/main/java/com/microsoft/fluentui/theme/token/controlTokens/CardNudgeTokens.kt @@ -31,6 +31,11 @@ open class CardNudgeTokens : IControlToken, Parcelable { return aliasTokens.brandForegroundColor[FluentAliasTokens.BrandForegroundColorTokens.BrandForegroundTint].value() } + @Composable + open fun dismissIconColor(cardNudgeInfo: CardNudgeInfo): Color { + return aliasTokens.brandForegroundColor[FluentAliasTokens.BrandForegroundColorTokens.BrandForegroundTint].value() + } + @Composable open fun accentColor(cardNudgeInfo: CardNudgeInfo): Color { return aliasTokens.brandForegroundColor[FluentAliasTokens.BrandForegroundColorTokens.BrandForeground1].value() @@ -77,10 +82,10 @@ open class CardNudgeTokens : IControlToken, Parcelable { FluentGlobalTokens.strokeWidth(FluentGlobalTokens.StrokeWidthTokens.StrokeWidth10) @Composable - open fun leftIconSize(cardNudgeInfo: CardNudgeInfo): Dp = 24.dp + open fun iconSize(cardNudgeInfo: CardNudgeInfo): Dp = 24.dp @Composable - open fun leftIconBackgroundSize(cardNudgeInfo: CardNudgeInfo): Dp = 40.dp + open fun iconBackgroundSize(cardNudgeInfo: CardNudgeInfo): Dp = 40.dp @Composable open fun dismissIconSize(cardNudgeInfo: CardNudgeInfo): Dp = 20.dp diff --git a/fluentui_notification/src/main/java/com/microsoft/fluentui/tokenized/notification/CardNudge.kt b/fluentui_notification/src/main/java/com/microsoft/fluentui/tokenized/notification/CardNudge.kt index 10fdd26fc..88d5c5a00 100644 --- a/fluentui_notification/src/main/java/com/microsoft/fluentui/tokenized/notification/CardNudge.kt +++ b/fluentui_notification/src/main/java/com/microsoft/fluentui/tokenized/notification/CardNudge.kt @@ -148,7 +148,7 @@ fun CardNudge( if (metadata.icon != null && metadata.icon.isIconAvailable()) { Box( modifier = Modifier - .size(token.leftIconBackgroundSize(cardNudgeInfo)) + .size(token.iconBackgroundSize(cardNudgeInfo)) .background( token.iconBackgroundBrush(cardNudgeInfo), CircleShape @@ -170,8 +170,8 @@ fun CardNudge( Icon( metadata.icon, modifier = Modifier - .size(token.leftIconSize(cardNudgeInfo)), - tint = token.iconColor(cardNudgeInfo) + .size(token.iconSize(cardNudgeInfo)), + tint = metadata.icon.tint ?: token.iconColor(cardNudgeInfo) ) } } @@ -199,7 +199,7 @@ fun CardNudge( ) { Icon( metadata.accentIcon, - tint = token.accentColor(cardNudgeInfo) + tint = metadata.accentIcon.tint ?: token.accentColor(cardNudgeInfo) ) } } @@ -265,7 +265,7 @@ fun CardNudge( .padding(10.dp) .size(token.dismissIconSize(cardNudgeInfo)) .testTag(CARD_NUDGE_DISMISS_BUTTON), - tint = token.iconColor(cardNudgeInfo), + tint = token.dismissIconColor(cardNudgeInfo), onClick = metadata.dismissOnClick ) }