@@ -49,7 +49,11 @@ object BigIcon {
4949 * @param vectorIcon the [ImageVector] to display
5050 * @param contentDescription the content description of the icon, if any. It defaults to `null`
5151 */
52- data class Default (val vectorIcon : ImageVector , val contentDescription : String? = null ) : Style
52+ data class Default (
53+ val vectorIcon : ImageVector ,
54+ val contentDescription : String? = null ,
55+ val destructive : Boolean = false ,
56+ ) : Style
5357
5458 /* *
5559 * An alert style with a transparent background.
@@ -84,25 +88,40 @@ object BigIcon {
8488 modifier : Modifier = Modifier ,
8589 ) {
8690 val backgroundColor = when (style) {
87- is Style .Default -> ElementTheme .colors.bgSubtleSecondary
88- Style .Alert , Style .Success -> Color .Transparent
91+ is Style .Default -> if (style.destructive) {
92+ ElementTheme .colors.bgCriticalSubtle
93+ } else {
94+ ElementTheme .colors.bgSubtleSecondary
95+ }
96+ Style .Alert ,
97+ Style .Success -> Color .Transparent
8998 Style .AlertSolid -> ElementTheme .colors.bgCriticalSubtle
9099 Style .SuccessSolid -> ElementTheme .colors.bgSuccessSubtle
91100 }
92101 val icon = when (style) {
93102 is Style .Default -> style.vectorIcon
94- Style .Alert , Style .AlertSolid -> CompoundIcons .Error ()
95- Style .Success , Style .SuccessSolid -> CompoundIcons .CheckCircleSolid ()
103+ Style .Alert ,
104+ Style .AlertSolid -> CompoundIcons .Error ()
105+ Style .Success ,
106+ Style .SuccessSolid -> CompoundIcons .CheckCircleSolid ()
96107 }
97108 val contentDescription = when (style) {
98109 is Style .Default -> style.contentDescription
99- Style .Alert , Style .AlertSolid -> stringResource(CommonStrings .common_error)
100- Style .Success , Style .SuccessSolid -> stringResource(CommonStrings .common_success)
110+ Style .Alert ,
111+ Style .AlertSolid -> stringResource(CommonStrings .common_error)
112+ Style .Success ,
113+ Style .SuccessSolid -> stringResource(CommonStrings .common_success)
101114 }
102115 val iconTint = when (style) {
103- is Style .Default -> ElementTheme .colors.iconSecondary
104- Style .Alert , Style .AlertSolid -> ElementTheme .colors.iconCriticalPrimary
105- Style .Success , Style .SuccessSolid -> ElementTheme .colors.iconSuccessPrimary
116+ is Style .Default -> if (style.destructive) {
117+ ElementTheme .colors.iconCriticalPrimary
118+ } else {
119+ ElementTheme .colors.iconSecondary
120+ }
121+ Style .Alert ,
122+ Style .AlertSolid -> ElementTheme .colors.iconCriticalPrimary
123+ Style .Success ,
124+ Style .SuccessSolid -> ElementTheme .colors.iconSuccessPrimary
106125 }
107126 Box (
108127 modifier = modifier
@@ -140,6 +159,7 @@ internal class BigIconStyleProvider : PreviewParameterProvider<BigIcon.Style> {
140159 BigIcon .Style .Default (Icons .Filled .CatchingPokemon ),
141160 BigIcon .Style .Alert ,
142161 BigIcon .Style .AlertSolid ,
162+ BigIcon .Style .Default (Icons .Filled .CatchingPokemon , destructive = true ),
143163 BigIcon .Style .Success ,
144164 BigIcon .Style .SuccessSolid
145165 )
0 commit comments