Updated on 2026-08-14

This commit is contained in:
Tangem 2025-10-13 13:43:06 +05:00
parent 4bb7fde041
commit 4341673767
20 changed files with 276 additions and 351 deletions

View file

@ -51,7 +51,19 @@ fun BlockItem(model: BlockUM, modifier: Modifier = Modifier) {
overflow = TextOverflow.Ellipsis,
)
model.label?.let { Label(it) }
when (val endContent = model.endContent) {
is BlockUM.EndContent.None -> Unit
is BlockUM.EndContent.Icon -> Icon(
painter = painterResource(id = endContent.resId),
contentDescription = null,
tint = when (endContent.accentType) {
BlockUM.AccentType.NONE -> TangemTheme.colors.text.primary1
BlockUM.AccentType.ACCENT -> TangemTheme.colors.text.accent
BlockUM.AccentType.WARNING -> TangemTheme.colors.text.warning
},
)
is BlockUM.EndContent.Label -> Label(endContent.label)
}
}
}
}

View file

@ -3,15 +3,29 @@ package com.tangem.core.ui.components.block.model
import androidx.annotation.DrawableRes
import com.tangem.core.ui.components.label.entity.LabelUM
import com.tangem.core.ui.extensions.TextReference
import javax.annotation.concurrent.Immutable
data class BlockUM(
val text: TextReference,
@DrawableRes val iconRes: Int,
val onClick: () -> Unit,
val accentType: AccentType = AccentType.NONE,
val label: LabelUM? = null,
val endContent: EndContent = EndContent.None,
) {
@Immutable
sealed interface EndContent {
data object None : EndContent
data class Label(
val label: LabelUM,
) : EndContent
data class Icon(
val resId: Int,
val accentType: AccentType = AccentType.NONE,
) : EndContent
}
enum class AccentType {
NONE, ACCENT, WARNING,
}

View file

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="16"
android:viewportHeight="16">
<path
android:pathData="M11.413,2.426C12.757,2.426 13.43,2.426 13.943,2.688C14.395,2.918 14.762,3.285 14.992,3.736C15.254,4.25 15.253,4.922 15.253,6.266V9.736C15.253,11.079 15.254,11.752 14.992,12.265C14.762,12.716 14.395,13.084 13.943,13.314C13.43,13.575 12.757,13.575 11.413,13.575H4.587C3.243,13.575 2.57,13.575 2.057,13.314C1.605,13.084 1.238,12.716 1.008,12.265C0.746,11.752 0.746,11.079 0.746,9.736V6.266C0.746,4.922 0.746,4.25 1.008,3.736C1.238,3.285 1.605,2.918 2.057,2.688C2.57,2.426 3.243,2.426 4.587,2.426H11.413ZM8,5.063C7.876,5.063 7.814,5.063 7.763,5.073C7.551,5.115 7.386,5.281 7.344,5.492C7.334,5.544 7.333,5.606 7.333,5.729V7.334H5.729C5.606,7.334 5.544,7.334 5.492,7.344C5.281,7.386 5.115,7.551 5.073,7.763C5.063,7.815 5.063,7.877 5.063,8.001C5.063,8.124 5.063,8.186 5.073,8.238C5.115,8.449 5.281,8.615 5.492,8.657C5.544,8.667 5.606,8.667 5.729,8.667H7.333V10.271C7.333,10.394 7.334,10.456 7.344,10.508C7.386,10.719 7.551,10.885 7.763,10.927C7.814,10.937 7.876,10.938 8,10.938C8.124,10.938 8.186,10.937 8.238,10.927C8.449,10.885 8.615,10.719 8.657,10.508C8.667,10.456 8.667,10.394 8.667,10.271V8.667H10.27C10.394,8.667 10.456,8.667 10.508,8.657C10.719,8.615 10.885,8.449 10.927,8.238C10.937,8.186 10.937,8.124 10.937,8.001C10.937,7.877 10.937,7.815 10.927,7.763C10.885,7.551 10.719,7.386 10.508,7.344C10.456,7.333 10.394,7.334 10.27,7.334H8.667V5.729C8.667,5.606 8.667,5.544 8.657,5.492C8.615,5.281 8.449,5.115 8.238,5.073C8.186,5.063 8.124,5.063 8,5.063Z"
android:fillColor="#0099FF"
android:fillType="evenOdd"/>
</vector>

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="16"
android:viewportHeight="16">
<path
android:pathData="M12.054,1.505C13.173,1.505 13.733,1.505 14.161,1.723C14.537,1.914 14.843,2.221 15.035,2.597C15.253,3.024 15.253,3.585 15.253,4.705V11.296C15.253,12.416 15.253,12.976 15.035,13.404C14.843,13.781 14.537,14.087 14.161,14.278C13.733,14.496 13.173,14.496 12.054,14.496H3.946C2.827,14.496 2.267,14.496 1.839,14.278C1.463,14.087 1.157,13.78 0.965,13.404C0.747,12.976 0.746,12.416 0.746,11.296V4.705C0.746,3.585 0.747,3.024 0.965,2.597C1.157,2.221 1.463,1.914 1.839,1.723C2.267,1.505 2.827,1.505 3.946,1.505H12.054ZM3.597,10.534C3.21,10.535 2.897,10.848 2.896,11.234C2.896,11.621 3.21,11.934 3.597,11.935H6.563C6.949,11.935 7.263,11.621 7.263,11.234C7.263,10.848 6.949,10.534 6.563,10.534H3.597ZM10.921,6.947C10.535,6.947 10.221,7.261 10.221,7.647V9.544L9.72,9.043C9.446,8.77 9.003,8.77 8.729,9.043C8.456,9.316 8.457,9.76 8.729,10.033L10.426,11.729C10.699,12.002 11.142,12.002 11.415,11.729L13.111,10.034C13.384,9.761 13.384,9.317 13.111,9.044C12.838,8.771 12.394,8.77 12.121,9.043L11.62,9.544V7.647C11.62,7.261 11.307,6.947 10.921,6.947ZM3.597,7.301C3.21,7.301 2.897,7.615 2.896,8.001C2.897,8.387 3.21,8.701 3.597,8.701H6.563C6.949,8.701 7.262,8.387 7.263,8.001C7.263,7.615 6.949,7.301 6.563,7.301H3.597ZM3.597,4.066C3.21,4.067 2.897,4.38 2.896,4.767C2.896,5.153 3.21,5.467 3.597,5.467H6.563C6.949,5.467 7.263,5.153 7.263,4.767C7.263,4.38 6.949,4.066 6.563,4.066H3.597ZM9.438,4.066C9.051,4.067 8.737,4.38 8.737,4.767C8.737,5.153 9.051,5.467 9.438,5.467H12.403C12.79,5.467 13.104,5.153 13.104,4.767C13.103,4.38 12.79,4.067 12.403,4.066H9.438Z"
android:fillColor="#0099FF"/>
</vector>

View file

@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="16"
android:viewportHeight="16">
<path
android:pathData="M4.559,7.397C5.105,7.397 5.547,7.839 5.547,8.385V13.432C5.547,13.977 5.105,14.419 4.559,14.419H1.91C1.364,14.419 0.922,13.977 0.922,13.432V8.385C0.922,7.839 1.364,7.397 1.91,7.397H4.559ZM2.773,8.382C2.482,8.382 2.246,8.617 2.246,8.908C2.246,9.199 2.482,9.435 2.773,9.435H3.695C3.986,9.435 4.221,9.199 4.221,8.908C4.221,8.617 3.986,8.382 3.695,8.382H2.773Z"
android:fillColor="#0099FF"
android:fillType="evenOdd"/>
<path
android:pathData="M9.376,1.58C9.887,1.58 10.267,1.58 10.596,1.668C11.485,1.905 12.179,2.598 12.417,3.484C12.473,3.693 12.493,3.923 12.501,4.194C12.597,4.203 12.689,4.213 12.778,4.225C13.375,4.305 13.902,4.479 14.324,4.9C14.746,5.322 14.922,5.848 15.002,6.443C15.078,7.011 15.078,7.727 15.078,8.596V9.971C15.078,10.84 15.078,11.557 15.002,12.124C14.922,12.72 14.746,13.246 14.324,13.667C13.902,14.089 13.375,14.263 12.778,14.343C12.209,14.419 11.491,14.419 10.619,14.419H6.666C6.658,14.419 6.65,14.419 6.642,14.419C6.784,14.12 6.865,13.785 6.865,13.432V8.385C6.865,7.112 5.833,6.08 4.56,6.08H1.91C1.557,6.08 1.221,6.16 0.922,6.302V3.506C0.922,2.442 1.786,1.58 2.852,1.58H9.376ZM12.271,8.29C11.645,8.29 11.138,8.797 11.138,9.423C11.138,10.048 11.645,10.555 12.271,10.555C12.896,10.555 13.404,10.048 13.404,9.423C13.403,8.797 12.896,8.29 12.271,8.29ZM2.852,2.864C2.497,2.864 2.208,3.151 2.208,3.506C2.208,3.86 2.497,4.148 2.852,4.148H10.619C10.825,4.148 11.022,4.148 11.211,4.149C11.205,3.983 11.194,3.892 11.173,3.816C11.054,3.373 10.707,3.026 10.263,2.908C10.12,2.869 9.926,2.864 9.286,2.864H2.852Z"
android:fillColor="#0099FF"
android:fillType="evenOdd"/>
</vector>