Skip to content

Commit a6641f4

Browse files
committed
refactor: rename component and add preview
1 parent 5a567e0 commit a6641f4

2 files changed

Lines changed: 27 additions & 14 deletions

File tree

app/src/main/java/to/bitkit/ui/components/SendSectionView.kt renamed to app/src/main/java/to/bitkit/ui/components/SendCell.kt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@ package to.bitkit.ui.components
33
import androidx.compose.foundation.layout.Column
44
import androidx.compose.foundation.layout.fillMaxWidth
55
import androidx.compose.material3.HorizontalDivider
6+
import androidx.compose.material3.Text
67
import androidx.compose.runtime.Composable
78
import androidx.compose.ui.Modifier
9+
import androidx.compose.ui.tooling.preview.Preview
810
import androidx.compose.ui.unit.dp
11+
import to.bitkit.ui.theme.AppThemeSurface
912
import to.bitkit.ui.theme.Colors
1013

1114
@Composable
12-
fun SendSectionView(
15+
fun SendCell(
1316
caption: String,
1417
modifier: Modifier = Modifier,
1518
content: @Composable () -> Unit,
@@ -22,3 +25,13 @@ fun SendSectionView(
2225
HorizontalDivider(modifier = Modifier.fillMaxWidth())
2326
}
2427
}
28+
29+
@Preview(showSystemUi = true)
30+
@Composable
31+
private fun Preview() {
32+
AppThemeSurface {
33+
SendCell(caption = "AMOUNT") {
34+
Text("0.001 BTC", color = Colors.White)
35+
}
36+
}
37+
}

app/src/main/java/to/bitkit/ui/screens/wallets/send/SendConfirmScreen.kt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ import to.bitkit.ui.components.Caption13Up
7373
import to.bitkit.ui.components.FillHeight
7474
import to.bitkit.ui.components.NumberPadActionButton
7575
import to.bitkit.ui.components.PrimaryButton
76-
import to.bitkit.ui.components.SendSectionView
76+
import to.bitkit.ui.components.SendCell
7777
import to.bitkit.ui.components.SwipeToConfirm
7878
import to.bitkit.ui.components.SyncNodeView
7979
import to.bitkit.ui.components.TagButton
@@ -411,7 +411,7 @@ private fun TagsSection(
411411
onClickAddTag: () -> Unit,
412412
modifier: Modifier = Modifier,
413413
) {
414-
SendSectionView(
414+
SendCell(
415415
caption = stringResource(R.string.wallet__tags),
416416
modifier = modifier
417417
) {
@@ -487,7 +487,7 @@ private fun OnChainDetails(
487487
horizontalArrangement = Arrangement.spacedBy(16.dp),
488488
modifier = Modifier.height(IntrinsicSize.Min)
489489
) {
490-
SendSectionView(
490+
SendCell(
491491
caption = stringResource(R.string.wallet__send_from),
492492
modifier = Modifier.weight(1f)
493493
) {
@@ -500,7 +500,7 @@ private fun OnChainDetails(
500500
modifier = Modifier.testTag("SendConfirmAssetButton")
501501
)
502502
}
503-
SendSectionView(
503+
SendCell(
504504
caption = stringResource(R.string.wallet__send_to),
505505
modifier = Modifier.weight(1f)
506506
) {
@@ -527,7 +527,7 @@ private fun OnChainDetails(
527527
.fillMaxHeight()
528528
.clickableAlpha { onEvent(SendEvent.SpeedAndFee) }
529529
) {
530-
SendSectionView(caption = stringResource(R.string.wallet__send_fee_and_speed)) {
530+
SendCell(caption = stringResource(R.string.wallet__send_fee_and_speed)) {
531531
Row(
532532
verticalAlignment = Alignment.CenterVertically,
533533
horizontalArrangement = Arrangement.spacedBy(4.dp),
@@ -561,7 +561,7 @@ private fun OnChainDetails(
561561
}
562562
}
563563
}
564-
SendSectionView(
564+
SendCell(
565565
caption = stringResource(R.string.wallet__send_confirming_in),
566566
modifier = Modifier.weight(1f)
567567
) {
@@ -607,7 +607,7 @@ private fun LightningDetails(
607607
horizontalArrangement = Arrangement.spacedBy(16.dp),
608608
modifier = Modifier.height(IntrinsicSize.Min)
609609
) {
610-
SendSectionView(
610+
SendCell(
611611
caption = stringResource(R.string.wallet__send_from),
612612
modifier = Modifier.weight(1f)
613613
) {
@@ -620,7 +620,7 @@ private fun LightningDetails(
620620
modifier = Modifier.testTag("SendConfirmAssetButton")
621621
)
622622
}
623-
SendSectionView(
623+
SendCell(
624624
caption = stringResource(R.string.wallet__send_to),
625625
modifier = Modifier.weight(1f)
626626
) {
@@ -647,7 +647,7 @@ private fun LightningDetails(
647647
.fillMaxHeight()
648648
.let { if (uiState.canSwitchWallet) it.clickableAlpha { onEvent(SendEvent.SpeedAndFee) } else it }
649649
) {
650-
SendSectionView(caption = stringResource(R.string.wallet__send_fee_and_speed)) {
650+
SendCell(caption = stringResource(R.string.wallet__send_fee_and_speed)) {
651651
Row(
652652
verticalAlignment = Alignment.CenterVertically,
653653
horizontalArrangement = Arrangement.spacedBy(4.dp),
@@ -683,7 +683,7 @@ private fun LightningDetails(
683683
}
684684
}
685685
if (!isLnurlPay && expirySeconds != null) {
686-
SendSectionView(
686+
SendCell(
687687
caption = stringResource(R.string.wallet__send_invoice_expiration),
688688
modifier = Modifier.weight(1f)
689689
) {
@@ -714,7 +714,7 @@ private fun LightningDetails(
714714
}
715715

716716
if (!isLnurlPay && !description.isNullOrEmpty()) {
717-
SendSectionView(caption = stringResource(R.string.wallet__note)) {
717+
SendCell(caption = stringResource(R.string.wallet__note)) {
718718
Row(modifier = Modifier.horizontalScroll(rememberScrollState())) {
719719
BodySSB(text = description, maxLines = 1)
720720
}
@@ -739,7 +739,7 @@ private fun LnurlPayDetails(
739739
) {
740740
val lnurlPay = uiState.lnurl as? LnurlParams.LnurlPay ?: return
741741
Column(modifier = modifier.fillMaxWidth()) {
742-
SendSectionView(caption = stringResource(R.string.wallet__send_invoice)) {
742+
SendCell(caption = stringResource(R.string.wallet__send_invoice)) {
743743
BodySSB(
744744
text = lnurlPay.data.uri,
745745
maxLines = 1,
@@ -754,7 +754,7 @@ private fun LnurlPayDetails(
754754

755755
VerticalSpacer(16.dp)
756756

757-
SendSectionView(caption = stringResource(R.string.wallet__send_fee_and_speed)) {
757+
SendCell(caption = stringResource(R.string.wallet__send_fee_and_speed)) {
758758
Row(
759759
verticalAlignment = Alignment.CenterVertically,
760760
horizontalArrangement = Arrangement.spacedBy(4.dp),

0 commit comments

Comments
 (0)