Update doc and rename param.

This commit is contained in:
Benoit Marty 2024-12-06 13:59:31 +01:00
parent eb420499ea
commit 2518295271

View file

@ -51,11 +51,12 @@ object BigIcon {
* *
* @param vectorIcon the [ImageVector] to display * @param vectorIcon the [ImageVector] to display
* @param contentDescription the content description of the icon, if any. It defaults to `null` * @param contentDescription the content description of the icon, if any. It defaults to `null`
* @param useCriticalTint whether the icon and background should be rendered using critical tint
*/ */
data class Default( data class Default(
val vectorIcon: ImageVector, val vectorIcon: ImageVector,
val contentDescription: String? = null, val contentDescription: String? = null,
val destructive: Boolean = false, val useCriticalTint: Boolean = false,
) : Style ) : Style
/** /**
@ -91,7 +92,7 @@ object BigIcon {
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
) { ) {
val backgroundColor = when (style) { val backgroundColor = when (style) {
is Style.Default -> if (style.destructive) { is Style.Default -> if (style.useCriticalTint) {
ElementTheme.colors.bgCriticalSubtle ElementTheme.colors.bgCriticalSubtle
} else { } else {
ElementTheme.colors.bgSubtleSecondary ElementTheme.colors.bgSubtleSecondary
@ -116,7 +117,7 @@ object BigIcon {
Style.SuccessSolid -> stringResource(CommonStrings.common_success) Style.SuccessSolid -> stringResource(CommonStrings.common_success)
} }
val iconTint = when (style) { val iconTint = when (style) {
is Style.Default -> if (style.destructive) { is Style.Default -> if (style.useCriticalTint) {
ElementTheme.colors.iconCriticalPrimary ElementTheme.colors.iconCriticalPrimary
} else { } else {
ElementTheme.colors.iconSecondary ElementTheme.colors.iconSecondary
@ -170,7 +171,7 @@ internal class BigIconStyleProvider : PreviewParameterProvider<BigIcon.Style> {
BigIcon.Style.Default(Icons.Filled.CatchingPokemon), BigIcon.Style.Default(Icons.Filled.CatchingPokemon),
BigIcon.Style.Alert, BigIcon.Style.Alert,
BigIcon.Style.AlertSolid, BigIcon.Style.AlertSolid,
BigIcon.Style.Default(Icons.Filled.CatchingPokemon, destructive = true), BigIcon.Style.Default(Icons.Filled.CatchingPokemon, useCriticalTint = true),
BigIcon.Style.Success, BigIcon.Style.Success,
BigIcon.Style.SuccessSolid BigIcon.Style.SuccessSolid
) )