Updated on 2026-08-14
This commit is contained in:
commit
91fd458dca
14 changed files with 251 additions and 271 deletions
|
|
@ -97,7 +97,7 @@ private fun FilterButtonsV2(
|
|||
iconPosition = com.tangem.core.ui.ds.button.TangemButtonIconPosition.End,
|
||||
size = TangemButtonSize.X9,
|
||||
shape = TangemButtonShape.Rounded,
|
||||
enabled = earnFilterUM.isNetworkFilterEnabled,
|
||||
isEnabled = earnFilterUM.isNetworkFilterEnabled,
|
||||
)
|
||||
|
||||
SpacerWMax()
|
||||
|
|
@ -109,7 +109,7 @@ private fun FilterButtonsV2(
|
|||
iconPosition = com.tangem.core.ui.ds.button.TangemButtonIconPosition.End,
|
||||
size = TangemButtonSize.X9,
|
||||
shape = TangemButtonShape.Rounded,
|
||||
enabled = earnFilterUM.isTypeFilterEnabled,
|
||||
isEnabled = earnFilterUM.isTypeFilterEnabled,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
@file:Suppress("MagicNumber", "LongMethod")
|
||||
|
||||
package com.tangem.feature.tester.presentation.storybook.page.buttons
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
|
|
@ -30,25 +31,25 @@ internal fun ButtonsStory(modifier: Modifier = Modifier) {
|
|||
.background(TangemTheme.colors2.surface.level1),
|
||||
) {
|
||||
item("primary") {
|
||||
ButtonSection(title = "Primary") { state, text, shape ->
|
||||
ButtonSection(title = "Primary") { isEnabled, text, shape ->
|
||||
PrimaryTangemButton(
|
||||
onClick = {},
|
||||
text = if (text) stringReference("Continue") else null,
|
||||
iconRes = R.drawable.ic_tangem_24,
|
||||
size = TangemButtonSize.X10,
|
||||
state = state,
|
||||
isEnabled = isEnabled,
|
||||
shape = shape,
|
||||
)
|
||||
}
|
||||
}
|
||||
item("secondary") {
|
||||
ButtonSection(title = "Secondary") { state, text, shape ->
|
||||
ButtonSection(title = "Secondary") { isEnabled, text, shape ->
|
||||
SecondaryTangemButton(
|
||||
onClick = {},
|
||||
text = if (text) stringReference("Continue") else null,
|
||||
iconRes = R.drawable.ic_tangem_24,
|
||||
size = TangemButtonSize.X10,
|
||||
state = state,
|
||||
isEnabled = isEnabled,
|
||||
shape = shape,
|
||||
)
|
||||
}
|
||||
|
|
@ -57,62 +58,62 @@ internal fun ButtonsStory(modifier: Modifier = Modifier) {
|
|||
ButtonSection(
|
||||
title = "PrimaryInverse",
|
||||
background = TangemTheme.colors2.surface.level2,
|
||||
) { state, text, shape ->
|
||||
) { isEnabled, text, shape ->
|
||||
PrimaryInverseTangemButton(
|
||||
onClick = {},
|
||||
text = if (text) stringReference("Continue") else null,
|
||||
iconRes = R.drawable.ic_tangem_24,
|
||||
size = TangemButtonSize.X10,
|
||||
state = state,
|
||||
isEnabled = isEnabled,
|
||||
shape = shape,
|
||||
)
|
||||
}
|
||||
}
|
||||
item("outline") {
|
||||
ButtonSection(title = "Outline") { state, text, shape ->
|
||||
ButtonSection(title = "Outline") { isEnabled, text, shape ->
|
||||
OutlineTangemButton(
|
||||
onClick = {},
|
||||
text = if (text) stringReference("Continue") else null,
|
||||
iconRes = R.drawable.ic_tangem_24,
|
||||
size = TangemButtonSize.X10,
|
||||
state = state,
|
||||
isEnabled = isEnabled,
|
||||
shape = shape,
|
||||
)
|
||||
}
|
||||
}
|
||||
item("accent") {
|
||||
ButtonSection(title = "Accent") { state, text, shape ->
|
||||
ButtonSection(title = "Accent") { isEnabled, text, shape ->
|
||||
StatusTangemButton(
|
||||
onClick = {},
|
||||
text = if (text) stringReference("Continue") else null,
|
||||
iconRes = R.drawable.ic_tangem_24,
|
||||
size = TangemButtonSize.X10,
|
||||
state = state,
|
||||
isEnabled = isEnabled,
|
||||
shape = shape,
|
||||
)
|
||||
}
|
||||
}
|
||||
item("positive") {
|
||||
ButtonSection(title = "Positive") { state, text, shape ->
|
||||
ButtonSection(title = "Positive") { isEnabled, text, shape ->
|
||||
StatusTangemButton(
|
||||
onClick = {},
|
||||
text = if (text) stringReference("Continue") else null,
|
||||
iconRes = R.drawable.ic_tangem_24,
|
||||
size = TangemButtonSize.X10,
|
||||
type = TangemButtonType.Positive,
|
||||
state = state,
|
||||
isEnabled = isEnabled,
|
||||
shape = shape,
|
||||
)
|
||||
}
|
||||
}
|
||||
item("ghost") {
|
||||
ButtonSection(title = "Ghost") { state, text, shape ->
|
||||
ButtonSection(title = "Ghost") { isEnabled, text, shape ->
|
||||
GhostTangemButton(
|
||||
onClick = {},
|
||||
text = if (text) stringReference("Continue") else null,
|
||||
iconRes = R.drawable.ic_tangem_24,
|
||||
size = TangemButtonSize.X10,
|
||||
state = state,
|
||||
isEnabled = isEnabled,
|
||||
shape = shape,
|
||||
)
|
||||
}
|
||||
|
|
@ -125,7 +126,7 @@ private fun ButtonSection(
|
|||
title: String,
|
||||
background: Color = TangemTheme.colors2.surface.level1,
|
||||
shapes: List<TangemButtonShape> = TangemButtonShape.entries,
|
||||
button: @Composable (state: TangemButtonState, text: Boolean, shape: TangemButtonShape) -> Unit,
|
||||
button: @Composable (isEnabled: Boolean, text: Boolean, shape: TangemButtonShape) -> Unit,
|
||||
) {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
|
|
@ -152,7 +153,7 @@ private fun ButtonSection(
|
|||
@Composable
|
||||
private fun ShapeGroup(
|
||||
shape: TangemButtonShape,
|
||||
button: @Composable (state: TangemButtonState, text: Boolean, shape: TangemButtonShape) -> Unit,
|
||||
button: @Composable (isEnabled: Boolean, text: Boolean, shape: TangemButtonShape) -> Unit,
|
||||
) {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Text(
|
||||
|
|
@ -161,9 +162,8 @@ private fun ShapeGroup(
|
|||
color = TangemTheme.colors.text.secondary,
|
||||
)
|
||||
ColumnHeaderRow()
|
||||
TangemButtonState.entries.forEach { state ->
|
||||
StateRow(state = state, shape = shape, button = button)
|
||||
}
|
||||
StateRow(isEnabled = true, shape = shape, button = button)
|
||||
StateRow(isEnabled = false, shape = shape, button = button)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -191,25 +191,25 @@ private fun ColumnHeaderRow() {
|
|||
|
||||
@Composable
|
||||
private fun StateRow(
|
||||
state: TangemButtonState,
|
||||
isEnabled: Boolean,
|
||||
shape: TangemButtonShape,
|
||||
button: @Composable (state: TangemButtonState, text: Boolean, shape: TangemButtonShape) -> Unit,
|
||||
button: @Composable (isEnabled: Boolean, text: Boolean, shape: TangemButtonShape) -> Unit,
|
||||
) {
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Text(
|
||||
text = state.name,
|
||||
text = if (isEnabled) "Enabled" else "Disabled",
|
||||
style = TangemTheme.typography.caption2,
|
||||
color = TangemTheme.colors.text.tertiary,
|
||||
modifier = Modifier.width(STATE_LABEL_WIDTH.dp),
|
||||
)
|
||||
Box(modifier = Modifier.weight(1f)) {
|
||||
button(state, true, shape)
|
||||
button(isEnabled, true, shape)
|
||||
}
|
||||
Box(modifier = Modifier.weight(1f)) {
|
||||
button(state, false, shape)
|
||||
button(isEnabled, false, shape)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
package com.tangem.feature.wallet.child.organizetokens.model.transformer
|
||||
|
||||
import com.tangem.core.ui.ds.button.TangemButtonState
|
||||
import com.tangem.feature.wallet.child.organizetokens.entity.OrganizeTokensUM
|
||||
import com.tangem.utils.transformer.Transformer
|
||||
|
||||
|
|
@ -13,18 +12,10 @@ internal class OrganizeSortingProgressStateTransformer(
|
|||
isEnabled = !isSortingInProgress,
|
||||
),
|
||||
cancelButton = prevState.cancelButton.copy(
|
||||
state = if (isSortingInProgress) {
|
||||
TangemButtonState.Disabled
|
||||
} else {
|
||||
TangemButtonState.Default
|
||||
},
|
||||
isEnabled = !isSortingInProgress,
|
||||
),
|
||||
applyButton = prevState.applyButton.copy(
|
||||
state = if (isSortingInProgress) {
|
||||
TangemButtonState.Loading
|
||||
} else {
|
||||
TangemButtonState.Default
|
||||
},
|
||||
isLoading = isSortingInProgress,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package com.tangem.feature.wallet.presentation.wallet.state.model
|
|||
import androidx.annotation.DrawableRes
|
||||
import androidx.compose.runtime.Immutable
|
||||
import com.tangem.core.ui.ds.button.TangemButtonShape
|
||||
import com.tangem.core.ui.ds.button.TangemButtonState
|
||||
import com.tangem.core.ui.ds.button.TangemButtonType
|
||||
import com.tangem.core.ui.ds.button.TangemButtonUM
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
|
|
@ -31,11 +30,6 @@ internal sealed class WalletActionButtons(
|
|||
shape = TangemButtonShape.Rounded,
|
||||
onClick = onClick,
|
||||
isEnabled = isEnabled,
|
||||
state = if (isEnabled) {
|
||||
TangemButtonState.Default
|
||||
} else {
|
||||
TangemButtonState.Disabled
|
||||
},
|
||||
)
|
||||
|
||||
data class Buy(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue