Skip to content

Commit

Permalink
[MERGE]ย #23ย -> develop
Browse files Browse the repository at this point in the history
[FEAT/#23] ํฌ์ปค์Šค ์—ฌ๋ถ€์— ๋”ฐ๋ผ ํžŒํŠธ ํ…์ŠคํŠธ ์ƒ‰์ƒ ๋ณ€๊ฒฝ
  • Loading branch information
arinming authored Jul 9, 2024
2 parents c617801 + 5163246 commit f1ac929
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.drawWithContent
import androidx.compose.ui.focus.onFocusChanged
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
Expand All @@ -33,11 +37,11 @@ import com.terning.core.designsystem.theme.White
fun TerningBasicTextField(
value: String,
onValueChange: (String) -> Unit,
readOnly: Boolean = false,
textStyle: TextStyle,
textColor: Color,
hintColor: Color,
drawLineColor: Color,
helperColor: Color,
cursorBrush: Brush,
strokeWidth: Float = 1f,
leftIcon: Int? = null,
Expand All @@ -47,19 +51,25 @@ fun TerningBasicTextField(
hint: String = "",
helperMessage: String = "",
helperIcon: Int? = null,
helperColor: Color = TerningMain,
) {
val keyboardController = LocalSoftwareKeyboardController.current
val focusManager = LocalFocusManager.current
val isFocused: MutableState<Boolean> = remember { mutableStateOf(false) }

BasicTextField(value = value,
BasicTextField(
value = value,
onValueChange = onValueChange,
singleLine = true,
maxLines = 1,
readOnly = readOnly,
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done),
keyboardActions = KeyboardActions(onDone = {
keyboardController?.hide()
focusManager.clearFocus()
}),
keyboardActions = KeyboardActions(
onDone = {
keyboardController?.hide()
focusManager.clearFocus()
}
),

modifier = Modifier
.fillMaxWidth()
Expand All @@ -75,6 +85,9 @@ fun TerningBasicTextField(
end = Offset(x = canvasWidth, y = canvasHeight),
strokeWidth = strokeWidth.dp.toPx(),
)
}
.onFocusChanged {
isFocused.value = it.isFocused
},

textStyle = textStyle.copy(color = textColor),
Expand All @@ -98,7 +111,7 @@ fun TerningBasicTextField(
Text(
text = hint,
style = textStyle,
color = hintColor
color = if (isFocused.value) hintColor else textColor
)
}
innerTextField()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import androidx.navigation.navOptions
import com.terning.feature.calendar.navigation.navigateCalendar
import com.terning.feature.home.navigation.navigateHome
import com.terning.feature.mypage.navigation.navigateMyPage
import com.terning.feature.onboarding.signin.navigation.SignIn
import com.terning.feature.search.navigation.Search
import com.terning.feature.search.navigation.navigateSearch

Expand All @@ -23,7 +22,7 @@ class MainNavigator(
@Composable get() = navController
.currentBackStackEntryAsState().value?.destination

val startDestination = SignIn
val startDestination = Search

val currentTab: MainTab?
@Composable get() = MainTab.find { tab ->
Expand Down

0 comments on commit f1ac929

Please sign in to comment.