Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Change currency textfield design #3625

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.BoxWithConstraintsScope
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
Expand All @@ -22,6 +21,8 @@ import com.ivy.design.l1_buildingBlocks.SpacerVer
import com.ivy.exchangerates.RatesEvent
import com.ivy.exchangerates.data.RateUi
import com.ivy.legacy.IvyWalletPreview
import com.ivy.legacy.utils.selectEndTextFieldValue
import com.ivy.wallet.ui.theme.components.IvyNameTextField
import com.ivy.wallet.ui.theme.modal.IvyModal
import com.ivy.wallet.ui.theme.modal.ModalAdd
import com.ivy.wallet.ui.theme.modal.ModalTitle
Expand All @@ -35,7 +36,7 @@ fun BoxWithConstraintsScope.AddRateModal(
dismiss: () -> Unit,
onAdd: (RatesEvent.AddRate) -> Unit,
) {
var toCurrency by remember { mutableStateOf("") }
var toCurrency by remember { mutableStateOf(selectEndTextFieldValue("")) }
var amountModalVisible by remember { mutableStateOf(false) }
var rate by remember { mutableStateOf<Double?>(null) }

Expand All @@ -51,7 +52,7 @@ fun BoxWithConstraintsScope.AddRateModal(
RatesEvent.AddRate(
RateUi(
from = baseCurrency,
to = to,
to = to.text,
rate = finalRate ?: 0.0,
)
)
Expand All @@ -63,16 +64,16 @@ fun BoxWithConstraintsScope.AddRateModal(
SpacerVer(height = 16.dp)
ModalTitle(text = "Add rate")
SpacerVer(height = 24.dp)
OutlinedTextField(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp),

IvyNameTextField(
modifier = Modifier.padding(horizontal = 32.dp),
underlineModifier = Modifier.padding(horizontal = 24.dp),
value = toCurrency,
label = {
Text(text = "Currency")
},
onValueChange = { toCurrency = it },
)
hint = "Currency"
) {
toCurrency = it
}

SpacerVer(height = 12.dp)
Text(
modifier = Modifier
Expand All @@ -81,7 +82,7 @@ fun BoxWithConstraintsScope.AddRateModal(
amountModalVisible = true
}
.padding(horizontal = 16.dp, vertical = 12.dp),
text = "$baseCurrency-$toCurrency = ${rate ?: "???"}",
text = "$baseCurrency-${toCurrency.text} = ${rate ?: "???"}",
style = UI.typo.nH2.style(
color = Orange,
textAlign = TextAlign.Center,
Expand Down
Loading