-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #119 from THT-Team/fix/TOP-84_signup_design_qa
TOP-84 Design 회원가입 디자인 QA 반영
- Loading branch information
Showing
100 changed files
with
2,675 additions
and
1,752 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
core/compose-ui/src/main/java/com/example/compose_ui/component/text/ThtTextField.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
package com.example.compose_ui.component.text | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.text.BasicTextField | ||
import androidx.compose.foundation.text.KeyboardActions | ||
import androidx.compose.foundation.text.KeyboardOptions | ||
import androidx.compose.material.LocalTextStyle | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.Immutable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.alpha | ||
import androidx.compose.ui.graphics.Brush | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.SolidColor | ||
import androidx.compose.ui.res.colorResource | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.text.TextStyle | ||
import androidx.compose.ui.text.font.FontWeight | ||
import tht.core.ui.R | ||
|
||
@Composable | ||
fun ThtTextField( | ||
value: String, | ||
onValueChange: (String) -> Unit, | ||
placeholder: String, | ||
singleLine: Boolean = false, | ||
modifier: Modifier = Modifier, | ||
onClear: (() -> Unit)? = null, | ||
cursorBrush: Brush = SolidColor(Color.White), | ||
keyboardOptions: KeyboardOptions = KeyboardOptions.Default, | ||
keyboardActions: KeyboardActions = KeyboardActions.Default, | ||
textColor: ThtTextFieldColor = ThtTextFieldColor.default(), | ||
textStyle: TextStyle = LocalTextStyle.current, | ||
placeholderTextStyle: TextStyle = LocalTextStyle.current | ||
) { | ||
Row { | ||
Box( | ||
modifier = modifier // weight(1f) 해줘여 clear 버튼 노출됨 | ||
) { | ||
Text( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.alpha(if (value.isEmpty()) 100f else 0f), | ||
text = placeholder, | ||
style = placeholderTextStyle.copy( | ||
color = textColor.placeHolder, | ||
fontWeight = FontWeight.SemiBold | ||
) | ||
) | ||
BasicTextField( | ||
modifier = Modifier | ||
.fillMaxWidth(), | ||
value = value, | ||
cursorBrush = cursorBrush, | ||
onValueChange = onValueChange, | ||
textStyle = textStyle.copy( | ||
color = textColor.text, | ||
fontWeight = FontWeight.SemiBold | ||
), | ||
singleLine = singleLine, | ||
keyboardOptions = keyboardOptions, | ||
keyboardActions = keyboardActions | ||
) | ||
} | ||
|
||
if (onClear != null && value.isNotEmpty()) { | ||
Image( | ||
modifier = Modifier | ||
.align(Alignment.CenterVertically) | ||
.clickable(true, onClick = onClear), | ||
painter = painterResource(id = com.example.compose_ui.R.drawable.ic_delete), | ||
contentDescription = "ic_delete" | ||
) | ||
} | ||
} | ||
} | ||
|
||
@Immutable | ||
data class ThtTextFieldColor( | ||
val placeHolder: Color, | ||
val text: Color | ||
) { | ||
companion object { | ||
@Composable | ||
fun default(): ThtTextFieldColor { | ||
return ThtTextFieldColor( | ||
placeHolder = colorResource(id = R.color.gray_8d8d8d), | ||
text = colorResource(id = R.color.yellow_f9cc2e), | ||
) | ||
} | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
core/compose-ui/src/main/java/com/example/compose_ui/component/text/ThtTextFieldLayout.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package com.example.compose_ui.component.text | ||
|
||
import androidx.compose.animation.AnimatedVisibility | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.text.KeyboardActions | ||
import androidx.compose.foundation.text.KeyboardOptions | ||
import androidx.compose.material.Divider | ||
import androidx.compose.material.LocalTextStyle | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.focus.FocusRequester | ||
import androidx.compose.ui.focus.focusRequester | ||
import androidx.compose.ui.graphics.Brush | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.SolidColor | ||
import androidx.compose.ui.text.TextStyle | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.unit.dp | ||
|
||
@Composable | ||
fun ThtTextFieldLayout( | ||
value: String, | ||
onValueChange: (String) -> Unit, | ||
placeholder: String, | ||
underLineColor: Color, | ||
modifier: Modifier = Modifier, | ||
singleLine: Boolean = false, | ||
onClear: (() -> Unit)? = null, | ||
cursorBrush: Brush = SolidColor(Color.White), | ||
keyboardOptions: KeyboardOptions = KeyboardOptions.Default, | ||
keyboardActions: KeyboardActions = KeyboardActions.Default, | ||
textColor: ThtTextFieldColor = ThtTextFieldColor.default(), | ||
textStyle: TextStyle = LocalTextStyle.current, | ||
placeholderTextStyle: TextStyle = LocalTextStyle.current, | ||
focusRequester: FocusRequester = FocusRequester(), | ||
errorVisible: Boolean = false, | ||
error: @Composable (() -> Unit)? = null | ||
) { | ||
Column { | ||
ThtTextField( | ||
onClear = onClear, | ||
modifier = modifier.focusRequester(focusRequester).weight(1f), | ||
cursorBrush = cursorBrush, | ||
value = value, | ||
onValueChange = onValueChange, | ||
placeholder = placeholder, | ||
singleLine = singleLine, | ||
placeholderTextStyle = placeholderTextStyle.copy( | ||
color = textColor.placeHolder, | ||
fontWeight = FontWeight.SemiBold | ||
), | ||
textStyle = textStyle.copy( | ||
color = textColor.text, | ||
fontWeight = FontWeight.SemiBold | ||
), | ||
keyboardOptions = keyboardOptions, | ||
keyboardActions = keyboardActions | ||
) | ||
Spacer(modifier = Modifier.height(4.dp)) | ||
Divider( | ||
modifier = Modifier.fillMaxWidth(), | ||
color = underLineColor, | ||
thickness = 2.dp | ||
) | ||
AnimatedVisibility( | ||
visible = error != null && errorVisible | ||
) { | ||
error?.invoke() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.