Skip to content

Commit

Permalink
[YDS-#205] improve: 코드리뷰 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
coding-polarbear committed Nov 4, 2023
1 parent 0f96a13 commit 83b1431
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ fun PasswordTextField(
focusedBorderColor = YdsTheme.colors.textPointed,
disabledTextColor = YdsTheme.colors.textDisabled,
disabledBorderColor = Color.Transparent,
textColor = YdsTheme.colors.textSecondary
textColor = YdsTheme.colors.textSecondary,
),
isError = isError,
enabled = isEnabled,
Expand All @@ -76,17 +76,17 @@ fun PasswordTextField(
},
trailingIcon = {
if (showPassword) {
IconButton(onClick = { showPassword = false}) {
IconButton(onClick = { showPassword = false }) {
Icon(
id = R.drawable.ic_eyeclosed_line,
iconSize = IconSize.Medium
iconSize = IconSize.Medium,
)
}
} else {
IconButton(onClick = { showPassword = true}) {
IconButton(onClick = { showPassword = true }) {
Icon(
id = R.drawable.ic_eyeopen_line,
iconSize = IconSize.Medium
iconSize = IconSize.Medium,
)
}
}
Expand All @@ -100,10 +100,10 @@ fun PasswordTextField(
Spacer(
modifier = Modifier
.width(16.dp)
.padding(0.dp),
)
YdsText(
text = hintText, style = YdsTheme.typography.caption1,
text = hintText,
style = YdsTheme.typography.caption1,
color = if (isError) {
YdsTheme.colors.textWarned
} else if (!isEnabled) {
Expand All @@ -122,12 +122,14 @@ fun PasswordTextField(
@Composable
fun PreviewPasswordTextField() {
var isError by remember { mutableStateOf(false) }
var text by rememberSaveable { mutableStateOf("") }
Column {
PasswordTextField(
isError = isError, isEnabled = true,
placeHolder = "플레이스 홀더",
onValueChange = { value ->
isError = value.equals("x")
text = value
},
hintText = "힌트 텍스트",
modifier = Modifier.padding(10.dp),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import com.yourssu.design.system.compose.base.YdsText

@Composable
fun SimpleTextField(
text: String = "",
modifier: Modifier = Modifier,
isError: Boolean = false,
isEnabled: Boolean = true,
Expand All @@ -39,14 +40,10 @@ fun SimpleTextField(
keyboardOptions: KeyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text),
onErrorChange: (Boolean) -> Unit,
) {
var text by rememberSaveable { mutableStateOf("") }
Column(modifier = modifier) {
OutlinedTextField(
value = text,
onValueChange = { value: String ->
text = value
onValueChange(value)
},
onValueChange = onValueChange,
modifier = Modifier.fillMaxWidth(),
shape = RoundedCornerShape(8.dp),
colors = TextFieldDefaults.outlinedTextFieldColors(
Expand All @@ -72,7 +69,7 @@ fun SimpleTextField(
if (text.isNotEmpty()) {
IconButton(
onClick = {
text = ""
onValueChange("")
onErrorChange(false)
},
) {
Expand All @@ -92,10 +89,10 @@ fun SimpleTextField(
Spacer(
modifier = Modifier
.width(16.dp)
.padding(0.dp),
)
YdsText(
text = hintText, style = YdsTheme.typography.caption1,
text = hintText,
style = YdsTheme.typography.caption1,
color = if (isError) {
YdsTheme.colors.textWarned
} else if (!isEnabled) {
Expand All @@ -114,12 +111,15 @@ fun SimpleTextField(
@Composable
fun PreviewSimpleTextField() {
var isError by remember { mutableStateOf(false) }
var text by rememberSaveable { mutableStateOf("") }
Column {
SimpleTextField(
text = text,
isError = isError, isEnabled = true,
placeHolder = "플레이스 홀더",
onValueChange = { value ->
isError = value.equals("x")
isError = value == "x"
text = value
},
hintText = "힌트 텍스트",
modifier = Modifier.padding(10.dp),
Expand Down

0 comments on commit 83b1431

Please sign in to comment.