mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 07:05:35 +03:00
Reskin BitwardenTextInput and pull out "layout parameters" (#69)
This commit is contained in:
parent
214df06320
commit
1dccee6c45
4 changed files with 35 additions and 11 deletions
|
@ -82,21 +82,25 @@ fun CreateAccountScreen(
|
|||
label = stringResource(id = R.string.email_address),
|
||||
value = state.emailInput,
|
||||
onValueChange = { viewModel.trySendAction(EmailInputChange(it)) },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
BitwardenTextField(
|
||||
label = stringResource(id = R.string.master_password),
|
||||
value = state.passwordInput,
|
||||
onValueChange = { viewModel.trySendAction(PasswordInputChange(it)) },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
BitwardenTextField(
|
||||
label = stringResource(id = R.string.retype_master_password),
|
||||
value = state.confirmPasswordInput,
|
||||
onValueChange = { viewModel.trySendAction(ConfirmPasswordInputChange(it)) },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
BitwardenTextField(
|
||||
label = stringResource(id = R.string.master_password_hint),
|
||||
value = state.passwordHintInput,
|
||||
onValueChange = { viewModel.trySendAction(PasswordHintChange(it)) },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,9 @@ fun LandingScreen(
|
|||
)
|
||||
|
||||
BitwardenTextField(
|
||||
modifier = Modifier.testTag("Email address"),
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.testTag("Email address"),
|
||||
value = state.emailInput,
|
||||
onValueChange = { viewModel.trySendAction(LandingAction.EmailInputChanged(it)) },
|
||||
label = stringResource(id = R.string.email_address),
|
||||
|
|
|
@ -47,7 +47,9 @@ fun LoginScreen(
|
|||
) {
|
||||
|
||||
BitwardenTextField(
|
||||
modifier = Modifier.testTag("Master password"),
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.testTag("Master password"),
|
||||
value = state.passwordInput,
|
||||
onValueChange = { viewModel.trySendAction(LoginAction.PasswordInputChanged(it)) },
|
||||
label = stringResource(id = R.string.master_password),
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package com.x8bit.bitwarden.ui.platform.components
|
||||
|
||||
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.material3.TextField
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
|
||||
/**
|
||||
* Component that allows the user to input text. This composable will manage the state of
|
||||
|
@ -23,12 +21,30 @@ fun BitwardenTextField(
|
|||
onValueChange: (String) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
TextField(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
label = { Text(label) },
|
||||
OutlinedTextField(
|
||||
modifier = modifier,
|
||||
label = { Text(text = label) },
|
||||
value = value,
|
||||
onValueChange = onValueChange,
|
||||
)
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun BitwardenTextField_preview_withInput() {
|
||||
BitwardenTextField(
|
||||
label = "Label",
|
||||
value = "Input",
|
||||
onValueChange = {},
|
||||
)
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun BitwardenTextField_preview_withoutInput() {
|
||||
BitwardenTextField(
|
||||
label = "Label",
|
||||
value = "",
|
||||
onValueChange = {},
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue