diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/rows/ActionRow.kt b/core/ui/src/main/java/com/tangem/core/ui/components/rows/ActionRow.kt new file mode 100644 index 0000000000..4dd409c78f --- /dev/null +++ b/core/ui/src/main/java/com/tangem/core/ui/components/rows/ActionRow.kt @@ -0,0 +1,78 @@ +package com.tangem.core.ui.components.rows + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.* +import androidx.compose.material.Icon +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.tooling.preview.Preview +import com.tangem.core.ui.R +import com.tangem.core.ui.components.SpacerH28 +import com.tangem.core.ui.components.rows.states.ActionRowState +import com.tangem.core.ui.res.TangemTheme + +/** + * Simple clickable action row, without input and icon + * + * https://www.figma.com/file/14ISV23YB1yVW1uNVwqrKv/Android?type=design&node-id=2100-807&mode=design&t=Ygv5sohTTHYAQcBS-4 + */ +@Composable +fun SimpleActionRow(state: ActionRowState, modifier: Modifier = Modifier) { + Box( + modifier = modifier + .background(color = TangemTheme.colors.background.action) + .height(TangemTheme.dimens.size44) + .fillMaxWidth(), + ) { + Column( + modifier = Modifier + .padding(end = TangemTheme.dimens.spacing48) + .align(Alignment.CenterStart), + verticalArrangement = Arrangement.spacedBy(TangemTheme.dimens.spacing8), + ) { + Text( + text = state.title, + style = TangemTheme.typography.caption2, + color = TangemTheme.colors.text.secondary, + ) + Text( + text = state.description, + style = TangemTheme.typography.body2, + color = TangemTheme.colors.text.primary1, + ) + } + + Icon( + painter = painterResource(id = R.drawable.ic_chevron_right_24), + contentDescription = null, + modifier = Modifier + .align(alignment = Alignment.CenterEnd) + .padding(end = TangemTheme.dimens.spacing12), + tint = TangemTheme.colors.icon.informative, + ) + } +} + +@Preview +@Composable +private fun SimpleActionRowPreview() { + val state = ActionRowState( + title = "Title", + description = "Description", + onClick = {}, + ) + Column { + TangemTheme(isDark = false) { + SimpleActionRow(state) + } + + SpacerH28() + + TangemTheme(isDark = false) { + SimpleActionRow(state) + } + } +} \ No newline at end of file diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/rows/states/ActionRowState.kt b/core/ui/src/main/java/com/tangem/core/ui/components/rows/states/ActionRowState.kt new file mode 100644 index 0000000000..35c6097d3a --- /dev/null +++ b/core/ui/src/main/java/com/tangem/core/ui/components/rows/states/ActionRowState.kt @@ -0,0 +1,7 @@ +package com.tangem.core.ui.components.rows.states + +data class ActionRowState( + val title: String, + val description: String, + val onClick: () -> Unit, +) \ No newline at end of file diff --git a/features/swap/presentation/src/main/java/com/tangem/feature/swap/models/states/ChooseFeeBottomSheetConfig.kt b/features/swap/presentation/src/main/java/com/tangem/feature/swap/models/states/ChooseFeeBottomSheetConfig.kt new file mode 100644 index 0000000000..f12f22bd79 --- /dev/null +++ b/features/swap/presentation/src/main/java/com/tangem/feature/swap/models/states/ChooseFeeBottomSheetConfig.kt @@ -0,0 +1,5 @@ +package com.tangem.feature.swap.models.states + +import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfigContent + +class ChooseFeeBottomSheetConfig : TangemBottomSheetConfigContent \ No newline at end of file diff --git a/features/swap/presentation/src/main/java/com/tangem/feature/swap/models/states/FeeItemState.kt b/features/swap/presentation/src/main/java/com/tangem/feature/swap/models/states/FeeItemState.kt new file mode 100644 index 0000000000..be4e3a3366 --- /dev/null +++ b/features/swap/presentation/src/main/java/com/tangem/feature/swap/models/states/FeeItemState.kt @@ -0,0 +1,8 @@ +package com.tangem.feature.swap.models.states + +import com.tangem.core.ui.components.rows.states.ActionRowState + +data class FeeItemState( + val id: String, + val actionRowState: ActionRowState, +) \ No newline at end of file diff --git a/features/swap/presentation/src/main/java/com/tangem/feature/swap/ui/ChooseFeeBottomSheet.kt b/features/swap/presentation/src/main/java/com/tangem/feature/swap/ui/ChooseFeeBottomSheet.kt new file mode 100644 index 0000000000..15d2f05826 --- /dev/null +++ b/features/swap/presentation/src/main/java/com/tangem/feature/swap/ui/ChooseFeeBottomSheet.kt @@ -0,0 +1,26 @@ +package com.tangem.feature.swap.ui + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Column +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import com.tangem.core.ui.components.bottomsheets.TangemBottomSheet +import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig +import com.tangem.core.ui.res.TangemTheme +import com.tangem.feature.swap.models.states.ChooseFeeBottomSheetConfig + +@Composable +fun ChooseFeeBottomSheet(config: TangemBottomSheetConfig) { + TangemBottomSheet(config) { content: ChooseFeeBottomSheetConfig -> + ChooseFeeBottomSheetContent(content = content) + } +} + +@Suppress("UnusedPrivateMember") +@Composable +private fun ChooseFeeBottomSheetContent(content: ChooseFeeBottomSheetConfig) { + Column( + modifier = Modifier.background(TangemTheme.colors.background.primary), + ) { + } +} \ No newline at end of file diff --git a/features/swap/presentation/src/main/java/com/tangem/feature/swap/ui/FeeItem.kt b/features/swap/presentation/src/main/java/com/tangem/feature/swap/ui/FeeItem.kt new file mode 100644 index 0000000000..4f895f7d34 --- /dev/null +++ b/features/swap/presentation/src/main/java/com/tangem/feature/swap/ui/FeeItem.kt @@ -0,0 +1,61 @@ +package com.tangem.feature.swap.ui + +import androidx.compose.foundation.background +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.* +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import com.tangem.core.ui.components.SpacerH24 +import com.tangem.core.ui.components.rows.SimpleActionRow +import com.tangem.core.ui.components.rows.states.ActionRowState +import com.tangem.core.ui.res.TangemTheme +import com.tangem.feature.swap.models.states.FeeItemState + +@Composable +fun FeeItem(state: FeeItemState) { + Box( + modifier = Modifier + .background( + color = TangemTheme.colors.background.action, + shape = TangemTheme.shapes.roundedCornersXMedium, + ) + .clickable( + onClick = state.actionRowState.onClick, + ) + .fillMaxWidth() + .defaultMinSize(minHeight = TangemTheme.dimens.size68), + ) { + SimpleActionRow( + modifier = Modifier.padding( + start = TangemTheme.dimens.spacing12, + top = TangemTheme.dimens.spacing12, + ), + state = state.actionRowState, + ) + } +} + +@Preview +@Composable +private fun FeeItemPreview() { + val state = FeeItemState( + id = "id", + actionRowState = ActionRowState( + title = "Title", + description = "Description", + onClick = {}, + ), + ) + Column { + TangemTheme(isDark = false) { + FeeItem(state = state) + } + + SpacerH24() + + TangemTheme(isDark = true) { + FeeItem(state = state) + } + } +} \ No newline at end of file