Updated on 2026-08-14
This commit is contained in:
parent
8cb232cd36
commit
89cb0e3cdb
3 changed files with 43 additions and 11 deletions
|
|
@ -10,6 +10,8 @@ import com.tangem.core.ui.extensions.TextReference
|
|||
* @property iconResId icon resource id
|
||||
* @property onClick lambda be invoked when action component is clicked
|
||||
* @property enabled enabled
|
||||
* @property dimContent determines whether the button content will be dimmed. This property will be ignored if [enabled]
|
||||
* is `false`.
|
||||
*
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
|
|
@ -18,4 +20,5 @@ data class ActionButtonConfig(
|
|||
@DrawableRes val iconResId: Int,
|
||||
val onClick: () -> Unit,
|
||||
val enabled: Boolean = true,
|
||||
val dimContent: Boolean = false,
|
||||
)
|
||||
|
|
@ -99,14 +99,22 @@ private fun Button(
|
|||
painter = painterResource(id = config.iconResId),
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(size = TangemTheme.dimens.size20),
|
||||
tint = if (config.enabled) TangemTheme.colors.icon.primary1 else TangemTheme.colors.icon.informative,
|
||||
tint = when {
|
||||
!config.enabled -> TangemTheme.colors.icon.informative
|
||||
config.dimContent -> TangemTheme.colors.icon.secondary
|
||||
else -> TangemTheme.colors.icon.primary1
|
||||
},
|
||||
)
|
||||
|
||||
SpacerW8()
|
||||
|
||||
Text(
|
||||
text = config.text.resolveReference(),
|
||||
color = if (config.enabled) TangemTheme.colors.text.primary1 else TangemTheme.colors.text.disabled,
|
||||
color = when {
|
||||
!config.enabled -> TangemTheme.colors.text.disabled
|
||||
config.dimContent -> TangemTheme.colors.text.secondary
|
||||
else -> TangemTheme.colors.text.primary1
|
||||
},
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
maxLines = 1,
|
||||
style = TangemTheme.typography.button,
|
||||
|
|
@ -154,6 +162,13 @@ private class ActionStateProvider : CollectionPreviewParameterProvider<ActionBut
|
|||
enabled = true,
|
||||
onClick = {},
|
||||
),
|
||||
ActionButtonConfig(
|
||||
text = TextReference.Str(value = "Dimmed"),
|
||||
iconResId = R.drawable.ic_arrow_up_24,
|
||||
enabled = true,
|
||||
dimContent = true,
|
||||
onClick = {},
|
||||
),
|
||||
ActionButtonConfig(
|
||||
text = TextReference.Str(value = "Disabled"),
|
||||
iconResId = R.drawable.ic_arrow_down_24,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue