Skip to content

Commit

Permalink
Merge pull request #37 from GSM-MSG/feature/#33_apply_changed_textfield
Browse files Browse the repository at this point in the history
🔀 :: (#33) - Apply changed Textfield
  • Loading branch information
wjdcksdn authored Oct 25, 2023
2 parents edd42c6 + e3ec729 commit 2e2986a
Showing 1 changed file with 29 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.msg.design_system.component.textfield

import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
Expand Down Expand Up @@ -61,16 +62,18 @@ fun EmailTextField(
color = when {
isDisabled -> colors.G1
isError -> colors.E5
text.isNotEmpty() && !isFocused.value -> colors.BLACK
text.isEmpty() && !isFocused.value -> colors.G1
text.isNotEmpty() -> colors.G1
isFocused.value -> colors.P5
else -> colors.G1
},
shape = RoundedCornerShape(8.dp)
)
.onFocusChanged {
isFocused.value = it.isFocused
},
}
.background(
color = if (isDisabled) colors.G9 else Color.Transparent
),
textStyle = typography.bodySmall,
colors = TextFieldDefaults.outlinedTextFieldColors(
placeholderColor = colors.G2,
Expand All @@ -80,6 +83,7 @@ fun EmailTextField(
disabledTextColor = colors.G1,
cursorColor = colors.P5
),
enabled = !isDisabled,
placeholder = {
Text(text = placeholder, style = typography.bodySmall)
},
Expand Down Expand Up @@ -152,12 +156,18 @@ fun PasswordTextField(
color = when {
isDisabled -> colors.G1
isError -> colors.E5
text.isNotEmpty()&&!isFocused.value -> colors.BLACK
text.isEmpty()&&!isFocused.value -> colors.G1
text.isNotEmpty() -> colors.G1
isFocused.value -> colors.P5
else -> colors.G1
},
shape = RoundedCornerShape(8.dp)
)
.onFocusChanged {
isFocused.value = it.isFocused
}
.background(
color = if (isDisabled) colors.G9 else Color.Transparent,
shape = RoundedCornerShape(8.dp)
),
textStyle = typography.bodySmall,
colors = TextFieldDefaults.outlinedTextFieldColors(
Expand All @@ -168,6 +178,7 @@ fun PasswordTextField(
disabledTextColor = colors.G1,
cursorColor = colors.P5
),
enabled = !isDisabled,
visualTransformation = if (showPassword) {
VisualTransformation.None
} else {
Expand Down Expand Up @@ -263,5 +274,18 @@ fun TextFieldPre() {
linkText = "Sign Up",
isDisabled = false
)

PasswordTextField(
modifier = Modifier
.width(320.dp)
.height(52.dp),
placeholder = "Put Password",
errorText = "Incorrect Password",
onValueChange = {},
onClickLink = {},
isError = false,
isLinked = false,
isDisabled = true
)
}
}

0 comments on commit 2e2986a

Please sign in to comment.