Updated on 2026-08-14
This commit is contained in:
parent
dc0b552f5a
commit
1e85dbe6f7
9 changed files with 73 additions and 42 deletions
|
|
@ -10,6 +10,7 @@ import androidx.compose.material3.Icon
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.alpha
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
|
|
@ -20,6 +21,8 @@ import com.tangem.core.ui.components.rows.model.BlockchainRowUM
|
|||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
|
||||
private const val DISABLED_ICON_ALPHA = 0.4f
|
||||
|
||||
/**
|
||||
* [Figma Component](https://www.figma.com/design/14ISV23YB1yVW1uNVwqrKv/Android?node-id=2737-2800&t=ewlXfWwbDnRhjw4B-4)
|
||||
* */
|
||||
|
|
@ -36,8 +39,9 @@ fun BlockchainRow(model: BlockchainRowUM, action: @Composable BoxScope.() -> Uni
|
|||
icon = {
|
||||
RowIcon(
|
||||
resId = model.iconResId,
|
||||
isColored = model.isSelected,
|
||||
isColored = model.isSelected && model.isEnabled,
|
||||
showAccentBadge = model.isMainNetwork,
|
||||
isEnabled = model.isEnabled,
|
||||
)
|
||||
},
|
||||
text = {
|
||||
|
|
@ -46,6 +50,7 @@ fun BlockchainRow(model: BlockchainRowUM, action: @Composable BoxScope.() -> Uni
|
|||
secondText = model.type,
|
||||
accentMainText = model.isSelected,
|
||||
accentSecondText = model.isMainNetwork,
|
||||
isEnabled = model.isEnabled,
|
||||
)
|
||||
},
|
||||
action = action,
|
||||
|
|
@ -58,10 +63,9 @@ private fun RowIcon(
|
|||
isColored: Boolean,
|
||||
showAccentBadge: Boolean,
|
||||
modifier: Modifier = Modifier,
|
||||
isEnabled: Boolean = true,
|
||||
) {
|
||||
Box(
|
||||
modifier = modifier.size(TangemTheme.dimens.size24),
|
||||
) {
|
||||
Box(modifier = modifier.size(TangemTheme.dimens.size24)) {
|
||||
if (isColored) {
|
||||
Image(
|
||||
modifier = Modifier
|
||||
|
|
@ -78,6 +82,7 @@ private fun RowIcon(
|
|||
color = TangemTheme.colors.button.secondary,
|
||||
shape = CircleShape,
|
||||
)
|
||||
.alpha(if (isEnabled) 1f else DISABLED_ICON_ALPHA)
|
||||
.size(TangemTheme.dimens.size22),
|
||||
painter = painterResource(id = resId),
|
||||
tint = TangemTheme.colors.icon.informative,
|
||||
|
|
@ -126,7 +131,7 @@ private fun Preview_BlockchainRow(@PreviewParameter(BlockchainRowParameterProvid
|
|||
BlockchainRow(
|
||||
model = state,
|
||||
action = {
|
||||
TangemSwitch(onCheckedChange = { }, checked = true)
|
||||
TangemSwitch(onCheckedChange = { }, checked = true, enabled = state.isEnabled)
|
||||
},
|
||||
)
|
||||
},
|
||||
|
|
@ -160,6 +165,15 @@ private class BlockchainRowParameterProvider : CollectionPreviewParameterProvide
|
|||
isMainNetwork = false,
|
||||
isSelected = false,
|
||||
),
|
||||
BlockchainRowUM(
|
||||
id = "2",
|
||||
name = "BNB BEACON CHAIN",
|
||||
type = "1234567890111213141516171819",
|
||||
iconResId = R.drawable.ic_bsc_16,
|
||||
isMainNetwork = false,
|
||||
isSelected = false,
|
||||
isEnabled = false,
|
||||
),
|
||||
),
|
||||
)
|
||||
// endregion Preview
|
||||
|
|
@ -53,6 +53,7 @@ internal fun RowText(
|
|||
accentSecondText: Boolean,
|
||||
modifier: Modifier = Modifier,
|
||||
subtitle: TextReference? = null,
|
||||
isEnabled: Boolean = true,
|
||||
) {
|
||||
Column(
|
||||
modifier = modifier,
|
||||
|
|
@ -67,7 +68,11 @@ internal fun RowText(
|
|||
modifier = Modifier.weight(weight = 10f, fill = false),
|
||||
text = mainText,
|
||||
style = TangemTheme.typography.subtitle2,
|
||||
color = if (accentMainText) TangemTheme.colors.text.primary1 else TangemTheme.colors.text.secondary,
|
||||
color = if (isEnabled) {
|
||||
if (accentMainText) TangemTheme.colors.text.primary1 else TangemTheme.colors.text.secondary
|
||||
} else {
|
||||
TangemTheme.colors.text.disabled
|
||||
},
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
|
|
@ -76,7 +81,11 @@ internal fun RowText(
|
|||
modifier = Modifier.weight(weight = 4f, fill = false),
|
||||
text = secondText,
|
||||
style = TangemTheme.typography.body2,
|
||||
color = if (accentSecondText) TangemTheme.colors.text.accent else TangemTheme.colors.text.secondary,
|
||||
color = if (isEnabled) {
|
||||
if (accentSecondText) TangemTheme.colors.text.accent else TangemTheme.colors.text.secondary
|
||||
} else {
|
||||
TangemTheme.colors.text.disabled
|
||||
},
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -10,4 +10,5 @@ data class BlockchainRowUM(
|
|||
val iconResId: Int,
|
||||
val isMainNetwork: Boolean,
|
||||
val isSelected: Boolean,
|
||||
val isEnabled: Boolean = true,
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue