Skip to content

Commit a98b99c

Browse files
committed
[refactor/#44] 리뷰 반영 : rippleClickable이 추가됨에 따라 chatTextField 의 enable 상태에도 반영
1 parent 8b164eb commit a98b99c

File tree

1 file changed

+13
-8
lines changed
  • core/designsystem/src/commonMain/kotlin/com/nexters/emotia/core/designsystem/component

1 file changed

+13
-8
lines changed

core/designsystem/src/commonMain/kotlin/com/nexters/emotia/core/designsystem/component/ChatTextField.kt

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ internal fun ChatTextFieldState.getBorderColor(): Color {
6363
}
6464

6565
@Composable
66-
internal fun ChatTextFieldState.getTextColor(): Color {
66+
internal fun getTextColor(): Color {
6767
val colors = LocalEmotiaColors.current
6868
return colors.white
6969
}
7070

7171
@Composable
72-
internal fun ChatTextFieldState.getPlaceholderColor(): Color {
72+
internal fun getPlaceholderColor(): Color {
7373
val colors = LocalEmotiaColors.current
7474
return colors.lightGray
7575
}
@@ -136,26 +136,31 @@ fun EmotiaChatTextField(
136136
}
137137
},
138138
trailingIcon = {
139+
val clickable = enabled && state.isSendEnabled()
139140
Image(
140141
painter = painterResource(state.getSendIconResource()),
141142
contentDescription = "전송",
142143
modifier = Modifier
143144
.size(36.dp)
144-
.rippleClickable {
145-
if (value.isNotEmpty()) onSendClick()
145+
.let { base ->
146+
if (clickable)
147+
base.rippleClickable {
148+
if (value.isNotEmpty() && enabled) onSendClick()
149+
}
150+
else base
146151
}
147152
)
148153
},
149154
singleLine = true,
150155
keyboardOptions = KeyboardOptions.Default.copy(imeAction = ImeAction.Send),
151156
keyboardActions = KeyboardActions(
152-
onSend = { if (value.isNotEmpty()) onSendClick() }
157+
onSend = { if (enabled && value.isNotEmpty()) onSendClick() }
153158
),
154159
shape = RoundedCornerShape(200.dp),
155160
colors = OutlinedTextFieldDefaults.colors(
156-
focusedTextColor = state.getTextColor(),
157-
unfocusedTextColor = state.getTextColor(),
158-
disabledTextColor = state.getTextColor(),
161+
focusedTextColor = getTextColor(),
162+
unfocusedTextColor = getTextColor(),
163+
disabledTextColor = getTextColor(),
159164
focusedBorderColor = state.getBorderColor(),
160165
unfocusedBorderColor = state.getBorderColor(),
161166
disabledBorderColor = state.getBorderColor(),

0 commit comments

Comments
 (0)