Skip to content

Commit 3f5fcba

Browse files
authored
Merge pull request #676 from code-payments/feat/discovery-currency-creator-upsell
fix(discovery): address upsell card layout overlap on smaller devices
2 parents d1f036e + ee5c839 commit 3f5fcba

1 file changed

Lines changed: 39 additions & 21 deletions

File tree

apps/flipcash/shared/tokens/src/main/kotlin/com/flipcash/app/tokens/ui/CurrencyCreatorUpsellCard.kt

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import androidx.compose.foundation.Image
44
import androidx.compose.foundation.layout.Arrangement
55
import androidx.compose.foundation.layout.Box
66
import androidx.compose.foundation.layout.Column
7-
import androidx.compose.foundation.layout.Row
7+
import androidx.compose.foundation.layout.defaultMinSize
88
import androidx.compose.foundation.layout.fillMaxWidth
99
import androidx.compose.foundation.layout.padding
10-
import androidx.compose.foundation.layout.requiredSize
10+
import androidx.compose.foundation.text.InlineTextContent
11+
import androidx.compose.foundation.text.appendInlineContent
1112
import androidx.compose.material.icons.Icons
1213
import androidx.compose.material.icons.automirrored.filled.ArrowForward
1314
import androidx.compose.material3.Icon
@@ -24,6 +25,9 @@ import androidx.compose.ui.layout.onSizeChanged
2425
import androidx.compose.ui.platform.LocalDensity
2526
import androidx.compose.ui.res.painterResource
2627
import androidx.compose.ui.res.stringResource
28+
import androidx.compose.ui.text.Placeholder
29+
import androidx.compose.ui.text.PlaceholderVerticalAlign
30+
import androidx.compose.ui.text.buildAnnotatedString
2731
import androidx.compose.ui.tooling.preview.Preview
2832
import androidx.compose.ui.tooling.preview.PreviewWrapper
2933
import androidx.compose.ui.unit.dp
@@ -47,37 +51,51 @@ fun CurrencyCreatorUpsellCard(
4751
) {
4852
Box(modifier = Modifier.fillMaxWidth()) {
4953
val density = LocalDensity.current
50-
var imageWidth by remember { mutableStateOf(0.dp) }
54+
var imageHeight by remember { mutableStateOf(0.dp) }
5155

5256
Column(
5357
modifier = Modifier
5458
.fillMaxWidth()
59+
.defaultMinSize(minHeight = imageHeight)
5560
.padding(
5661
start = CodeTheme.dimens.grid.x3,
5762
top = CodeTheme.dimens.grid.x3,
63+
bottom = CodeTheme.dimens.grid.x3,
5864
),
5965
verticalArrangement = Arrangement.spacedBy(CodeTheme.dimens.grid.x1),
6066
) {
61-
Row(
62-
modifier = Modifier.fillMaxWidth(),
63-
verticalAlignment = Alignment.CenterVertically,
64-
horizontalArrangement = Arrangement.spacedBy(CodeTheme.dimens.grid.x2)
65-
) {
66-
Text(
67-
text = stringResource(R.string.action_createYourOwnCurrency),
68-
style = CodeTheme.typography.screenTitle,
69-
color = CodeTheme.colors.textMain,
70-
)
71-
Icon(
72-
modifier = Modifier.requiredSize(CodeTheme.dimens.staticGrid.x4),
73-
imageVector = Icons.AutoMirrored.Default.ArrowForward,
74-
contentDescription = null,
75-
tint = CodeTheme.colors.textMain,
76-
)
67+
val arrowId = "arrow"
68+
val arrowSize = with(LocalDensity.current) {
69+
CodeTheme.dimens.staticGrid.x4.toSp()
70+
}
71+
val titleText = buildAnnotatedString {
72+
append(stringResource(R.string.action_createYourOwnCurrency))
73+
append(" ")
74+
appendInlineContent(arrowId)
7775
}
76+
Text(
77+
text = titleText,
78+
style = CodeTheme.typography.screenTitle,
79+
color = CodeTheme.colors.textMain,
80+
inlineContent = mapOf(
81+
arrowId to InlineTextContent(
82+
Placeholder(
83+
width = arrowSize,
84+
height = arrowSize,
85+
placeholderVerticalAlign = PlaceholderVerticalAlign.Center
86+
)
87+
) {
88+
Icon(
89+
imageVector = Icons.AutoMirrored.Default.ArrowForward,
90+
contentDescription = null,
91+
tint = CodeTheme.colors.textMain,
92+
)
93+
}
94+
)
95+
)
7896

7997
Text(
80-
modifier = Modifier.padding(end = imageWidth),
98+
modifier = Modifier.fillMaxWidth(0.65f),
8199
text = stringResource(R.string.subtitle_createYourOwnCurrency),
82100
style = CodeTheme.typography.textSmall,
83101
color = CodeTheme.colors.textSecondary,
@@ -88,7 +106,7 @@ fun CurrencyCreatorUpsellCard(
88106
modifier = Modifier
89107
.align(Alignment.BottomEnd)
90108
.onSizeChanged { size ->
91-
imageWidth = with(density) { size.width.toDp() }
109+
imageHeight = with(density) { size.height.toDp() }
92110
},
93111
painter = painterResource(R.drawable.ic_bill_previews),
94112
contentDescription = null,

0 commit comments

Comments
 (0)