From 63e2097bae9cb2cbb2ff40f662dda8d5dc50e3d3 Mon Sep 17 00:00:00 2001 From: arinming Date: Sun, 7 Jul 2024 23:35:47 +0900 Subject: [PATCH 1/9] [ADD/#19] TextField DecorationBox Add --- .../textfield/TerningTextField.kt | 68 +++++++++++++++++++ .../com/terning/feature/main/MainNavigator.kt | 4 +- .../com/terning/feature/main/MainScreen.kt | 21 ++++-- .../com/terning/feature/search/SearchRoute.kt | 18 ++++- 4 files changed, 101 insertions(+), 10 deletions(-) create mode 100644 core/src/main/java/com/terning/core/designsystem/textfield/TerningTextField.kt diff --git a/core/src/main/java/com/terning/core/designsystem/textfield/TerningTextField.kt b/core/src/main/java/com/terning/core/designsystem/textfield/TerningTextField.kt new file mode 100644 index 000000000..1ff804ffc --- /dev/null +++ b/core/src/main/java/com/terning/core/designsystem/textfield/TerningTextField.kt @@ -0,0 +1,68 @@ +package com.terning.core.designsystem.textfield + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.text.BasicTextField +import androidx.compose.material3.Icon +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.drawWithContent +import androidx.compose.ui.geometry.Offset +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.unit.dp +import com.terning.core.R +import com.terning.core.designsystem.theme.TerningMain +import com.terning.core.designsystem.theme.TerningTypography +import com.terning.core.designsystem.theme.White + +@Composable +fun TerningTextField( + value: String, + onValueChange: (String) -> Unit, + modifier: Modifier = Modifier, +) { + BasicTextField( + value = value, + onValueChange = onValueChange, + modifier = Modifier + .fillMaxWidth() + .background(White), + textStyle = TerningTypography().button3, + decorationBox = { innerTextField -> + Column(modifier = Modifier.drawWithContent { + drawContent() + drawLine( + color = TerningMain, + start = Offset( + x = 0f, + y = size.height - 1.dp.toPx(), + ), + end = Offset( + x = size.width, + y = size.height - 1.dp.toPx(), + ), + strokeWidth = 2.dp.toPx(), + ) + }) { + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(12.dp), + ) { + Icon( + painter = painterResource(id = R.drawable.ic_back), + contentDescription = null, + tint = TerningMain, + ) + innerTextField() + } + Spacer(modifier = Modifier.height(8.dp)) + } + } + ) +} \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/main/MainNavigator.kt b/feature/src/main/java/com/terning/feature/main/MainNavigator.kt index beb7b7920..e67b04927 100644 --- a/feature/src/main/java/com/terning/feature/main/MainNavigator.kt +++ b/feature/src/main/java/com/terning/feature/main/MainNavigator.kt @@ -12,7 +12,7 @@ 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 class MainNavigator( @@ -22,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 -> diff --git a/feature/src/main/java/com/terning/feature/main/MainScreen.kt b/feature/src/main/java/com/terning/feature/main/MainScreen.kt index 9d51ef625..150101db0 100644 --- a/feature/src/main/java/com/terning/feature/main/MainScreen.kt +++ b/feature/src/main/java/com/terning/feature/main/MainScreen.kt @@ -21,7 +21,6 @@ import androidx.navigation.compose.NavHost import com.terning.core.designsystem.theme.Grey300 import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.White -import com.terning.core.designsystem.topappbar.BackButtonTopAppBar import com.terning.core.designsystem.topappbar.LogoTopAppBar import com.terning.core.designsystem.topappbar.MyPageTopAppBar import com.terning.core.designsystem.topappbar.TerningTopAppBar @@ -42,10 +41,7 @@ fun MainScreen( topBar = { when (navigator.currentTab) { MainTab.HOME -> LogoTopAppBar() - MainTab.CALENDAR -> BackButtonTopAppBar( - title = "dkssud", - onBackButtonClick = { navigator.navigateUp() }) - + MainTab.CALENDAR -> TerningTopAppBar() MainTab.SEARCH -> LogoTopAppBar() MainTab.MY_PAGE -> MyPageTopAppBar() null -> TerningTopAppBar() @@ -80,6 +76,21 @@ fun MainScreen( } } + + +@Composable +private fun MainTopBar( + isVisible: Boolean, + tabs: List, + currentTab: MainTab?, + onTabSelected: (MainTab) -> Unit, +) { + AnimatedVisibility( + visible = isVisible, + ) { + } +} + @Composable private fun MainBottomBar( isVisible: Boolean, diff --git a/feature/src/main/java/com/terning/feature/search/SearchRoute.kt b/feature/src/main/java/com/terning/feature/search/SearchRoute.kt index 3ba7af3d4..85b150e6a 100644 --- a/feature/src/main/java/com/terning/feature/search/SearchRoute.kt +++ b/feature/src/main/java/com/terning/feature/search/SearchRoute.kt @@ -3,11 +3,15 @@ package com.terning.feature.search import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding -import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier -import com.terning.core.designsystem.topappbar.LogoTopAppBar +import androidx.compose.ui.unit.dp +import com.terning.core.designsystem.textfield.TerningTextField @Composable fun SearchRoute() { @@ -16,10 +20,18 @@ fun SearchRoute() { @Composable fun SearchScreen(modifier: Modifier = Modifier) { + var text by remember { mutableStateOf("") } Column( modifier = Modifier .fillMaxWidth() + .padding(horizontal = 16.dp) ) { Text(text = "탐색 스크린") + TerningTextField( + value = text, + onValueChange = { newText -> + text = newText + } + ) } -} +} \ No newline at end of file From f3c312e6f2efa31051780ee69655ccb718ca303e Mon Sep 17 00:00:00 2001 From: arinming Date: Mon, 8 Jul 2024 00:04:31 +0900 Subject: [PATCH 2/9] =?UTF-8?q?[FEAT/#19]=20TextField=20=EC=86=8D=EC=84=B1?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../textfield/TerningTextField.kt | 86 +++++++++++++------ .../com/terning/feature/search/SearchRoute.kt | 16 +++- 2 files changed, 73 insertions(+), 29 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/textfield/TerningTextField.kt b/core/src/main/java/com/terning/core/designsystem/textfield/TerningTextField.kt index 1ff804ffc..d0a68498e 100644 --- a/core/src/main/java/com/terning/core/designsystem/textfield/TerningTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/textfield/TerningTextField.kt @@ -2,21 +2,23 @@ package com.terning.core.designsystem.textfield import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding import androidx.compose.foundation.text.BasicTextField import androidx.compose.material3.Icon +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.drawWithContent import androidx.compose.ui.geometry.Offset +import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.TextStyle import androidx.compose.ui.unit.dp -import com.terning.core.R +import com.terning.core.designsystem.theme.Grey300 import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTypography import com.terning.core.designsystem.theme.White @@ -25,44 +27,76 @@ import com.terning.core.designsystem.theme.White fun TerningTextField( value: String, onValueChange: (String) -> Unit, - modifier: Modifier = Modifier, + textStyle: TextStyle, + hint: String = "", + hintColor: Color = Grey300, + strokeWidth: Float = 1f, + drawLineColor: Color, + leftIcon: Int? = null, + maxTextLength: Int? = null, + showTextLength: Boolean = false, + warningMessage: String? = null, ) { BasicTextField( value = value, onValueChange = onValueChange, modifier = Modifier .fillMaxWidth() - .background(White), - textStyle = TerningTypography().button3, - decorationBox = { innerTextField -> - Column(modifier = Modifier.drawWithContent { + .background(White) + .drawWithContent { + val canvasWidth = size.width + val canvasHeight = size.height + drawContent() drawLine( - color = TerningMain, - start = Offset( - x = 0f, - y = size.height - 1.dp.toPx(), - ), - end = Offset( - x = size.width, - y = size.height - 1.dp.toPx(), - ), - strokeWidth = 2.dp.toPx(), + color = drawLineColor, + start = Offset(x = 0f, y = canvasHeight), + end = Offset(x = canvasWidth, y = canvasHeight), + strokeWidth = strokeWidth.dp.toPx(), ) - }) { - Row( - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(12.dp), - ) { + }, + textStyle = textStyle, + + decorationBox = { innerTextField -> + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(12.dp), + modifier = Modifier.padding(vertical = 8.dp) + ) { + leftIcon?.let { Icon( - painter = painterResource(id = R.drawable.ic_back), + painter = painterResource(id = it), contentDescription = null, tint = TerningMain, ) + } + Box(modifier = Modifier.weight(1f)) { + if (value.isEmpty()) { + Text( + text = hint, + style = textStyle, + color = hintColor + ) + } innerTextField() } - Spacer(modifier = Modifier.height(8.dp)) } } ) + + if (showTextLength && maxTextLength != null) { + Text( + text = "${value.length}/$maxTextLength", + style = TerningTypography().button3, + color = Grey300, + ) + } + + warningMessage?.let { + Text( + text = it, + style = TerningTypography().button3, + color = Color.Red, + ) + } } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/search/SearchRoute.kt b/feature/src/main/java/com/terning/feature/search/SearchRoute.kt index 85b150e6a..4d1c9c542 100644 --- a/feature/src/main/java/com/terning/feature/search/SearchRoute.kt +++ b/feature/src/main/java/com/terning/feature/search/SearchRoute.kt @@ -12,6 +12,10 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import com.terning.core.designsystem.textfield.TerningTextField +import com.terning.core.designsystem.theme.Grey400 +import com.terning.core.designsystem.theme.TerningMain +import com.terning.core.designsystem.theme.TerningTypography +import com.terning.feature.R @Composable fun SearchRoute() { @@ -19,19 +23,25 @@ fun SearchRoute() { } @Composable -fun SearchScreen(modifier: Modifier = Modifier) { +fun SearchScreen() { var text by remember { mutableStateOf("") } + Column( modifier = Modifier .fillMaxWidth() .padding(horizontal = 16.dp) ) { - Text(text = "탐색 스크린") TerningTextField( value = text, onValueChange = { newText -> text = newText - } + }, + textStyle = TerningTypography().button3, + drawLineColor = TerningMain, + strokeWidth = 2f, + hint = "힌트텍스트", + hintColor = Grey400, + leftIcon = R.drawable.ic_nav_search, ) } } \ No newline at end of file From 3d47e7e86956b294059e151931a1f5ea14c8095f Mon Sep 17 00:00:00 2001 From: arinming Date: Mon, 8 Jul 2024 00:12:43 +0900 Subject: [PATCH 3/9] =?UTF-8?q?[FEAT/#19]=20SearchTextField=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designsystem/textfield/SearchTextField.kt | 25 +++++++++++++++++++ .../com/terning/feature/search/SearchRoute.kt | 19 +++++--------- feature/src/main/res/values/strings.xml | 2 ++ 3 files changed, 33 insertions(+), 13 deletions(-) create mode 100644 core/src/main/java/com/terning/core/designsystem/textfield/SearchTextField.kt diff --git a/core/src/main/java/com/terning/core/designsystem/textfield/SearchTextField.kt b/core/src/main/java/com/terning/core/designsystem/textfield/SearchTextField.kt new file mode 100644 index 000000000..36e6233b0 --- /dev/null +++ b/core/src/main/java/com/terning/core/designsystem/textfield/SearchTextField.kt @@ -0,0 +1,25 @@ +package com.terning.core.designsystem.textfield + +import androidx.compose.runtime.Composable +import com.terning.core.designsystem.theme.Grey400 +import com.terning.core.designsystem.theme.TerningMain +import com.terning.core.designsystem.theme.TerningTypography + +@Composable +fun SearchTextField( + text: String, + onValueChange: (String) -> Unit, + hint: String, + leftIcon: Int, +) { + TerningTextField( + value = text, + onValueChange = onValueChange, + textStyle = TerningTypography().button3, + drawLineColor = TerningMain, + strokeWidth = 2f, + hint = hint, + hintColor = Grey400, + leftIcon = leftIcon, + ) +} \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/search/SearchRoute.kt b/feature/src/main/java/com/terning/feature/search/SearchRoute.kt index 4d1c9c542..59d0503b4 100644 --- a/feature/src/main/java/com/terning/feature/search/SearchRoute.kt +++ b/feature/src/main/java/com/terning/feature/search/SearchRoute.kt @@ -3,18 +3,15 @@ package com.terning.feature.search import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding -import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp -import com.terning.core.designsystem.textfield.TerningTextField -import com.terning.core.designsystem.theme.Grey400 -import com.terning.core.designsystem.theme.TerningMain -import com.terning.core.designsystem.theme.TerningTypography +import com.terning.core.designsystem.textfield.SearchTextField import com.terning.feature.R @Composable @@ -31,17 +28,13 @@ fun SearchScreen() { .fillMaxWidth() .padding(horizontal = 16.dp) ) { - TerningTextField( - value = text, + SearchTextField( + text = text, onValueChange = { newText -> text = newText }, - textStyle = TerningTypography().button3, - drawLineColor = TerningMain, - strokeWidth = 2f, - hint = "힌트텍스트", - hintColor = Grey400, - leftIcon = R.drawable.ic_nav_search, + hint = stringResource(R.string.search_text_field_hint), + leftIcon = R.drawable.ic_nav_search ) } } \ No newline at end of file diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index 71aa3bf69..4193e573b 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -15,4 +15,6 @@ 카카오톡 로그인에 실패했습니다 로그인을 취소하였습니다 + + 관심있는 인턴 공고 키워드를 검색해보세요 \ No newline at end of file From 54b355b168047b2450ae8f25223785a481e3f6db Mon Sep 17 00:00:00 2001 From: arinming Date: Mon, 8 Jul 2024 00:46:44 +0900 Subject: [PATCH 4/9] =?UTF-8?q?[FEAT/#19]=20NameTextField=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designsystem/textfield/NameTextField.kt | 28 ++++++++++++ .../designsystem/textfield/SearchTextField.kt | 9 +++- .../textfield/TerningTextField.kt | 45 +++++++++++-------- .../com/terning/feature/search/SearchRoute.kt | 9 ++++ feature/src/main/res/values/strings.xml | 4 ++ 5 files changed, 74 insertions(+), 21 deletions(-) create mode 100644 core/src/main/java/com/terning/core/designsystem/textfield/NameTextField.kt diff --git a/core/src/main/java/com/terning/core/designsystem/textfield/NameTextField.kt b/core/src/main/java/com/terning/core/designsystem/textfield/NameTextField.kt new file mode 100644 index 000000000..23e0f7464 --- /dev/null +++ b/core/src/main/java/com/terning/core/designsystem/textfield/NameTextField.kt @@ -0,0 +1,28 @@ +package com.terning.core.designsystem.textfield + +import androidx.compose.runtime.Composable +import com.terning.core.designsystem.theme.Black +import com.terning.core.designsystem.theme.Grey300 +import com.terning.core.designsystem.theme.Grey500 +import com.terning.core.designsystem.theme.TerningTypography + +@Composable +fun NameTextField( + text: String, + onValueChange: (String) -> Unit, + hint: String, + helperMessage: String, +) { + TerningTextField( + value = text, + onValueChange = onValueChange, + textStyle = TerningTypography().detail1, + textColor = Black, + drawLineColor = Grey500, + hint = hint, + hintColor = Grey300, + showTextLength = true, + maxTextLength = 12, + helperMessage = helperMessage + ) +} \ No newline at end of file diff --git a/core/src/main/java/com/terning/core/designsystem/textfield/SearchTextField.kt b/core/src/main/java/com/terning/core/designsystem/textfield/SearchTextField.kt index 36e6233b0..7f6e2c254 100644 --- a/core/src/main/java/com/terning/core/designsystem/textfield/SearchTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/textfield/SearchTextField.kt @@ -1,6 +1,8 @@ package com.terning.core.designsystem.textfield import androidx.compose.runtime.Composable +import androidx.compose.ui.graphics.SolidColor +import com.terning.core.designsystem.theme.Grey300 import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTypography @@ -16,10 +18,13 @@ fun SearchTextField( value = text, onValueChange = onValueChange, textStyle = TerningTypography().button3, - drawLineColor = TerningMain, + textColor = Grey400, + cursorBrush = SolidColor(Grey300), + drawLineColor = Grey300, strokeWidth = 2f, hint = hint, - hintColor = Grey400, + hintColor = Grey300, leftIcon = leftIcon, + iconColor = Grey400 ) } \ No newline at end of file diff --git a/core/src/main/java/com/terning/core/designsystem/textfield/TerningTextField.kt b/core/src/main/java/com/terning/core/designsystem/textfield/TerningTextField.kt index d0a68498e..a4621851e 100644 --- a/core/src/main/java/com/terning/core/designsystem/textfield/TerningTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/textfield/TerningTextField.kt @@ -14,11 +14,14 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.drawWithContent import androidx.compose.ui.geometry.Offset +import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.SolidColor import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.TextStyle import androidx.compose.ui.unit.dp import com.terning.core.designsystem.theme.Grey300 +import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTypography import com.terning.core.designsystem.theme.White @@ -28,18 +31,22 @@ fun TerningTextField( value: String, onValueChange: (String) -> Unit, textStyle: TextStyle, + textColor: Color = TerningMain, + cursorBrush: Brush = SolidColor(TerningMain), hint: String = "", - hintColor: Color = Grey300, + hintColor: Color = TerningMain, strokeWidth: Float = 1f, drawLineColor: Color, leftIcon: Int? = null, + iconColor: Color = TerningMain, maxTextLength: Int? = null, showTextLength: Boolean = false, - warningMessage: String? = null, + helperMessage: String = "", ) { BasicTextField( value = value, onValueChange = onValueChange, + modifier = Modifier .fillMaxWidth() .background(White) @@ -55,7 +62,9 @@ fun TerningTextField( strokeWidth = strokeWidth.dp.toPx(), ) }, - textStyle = textStyle, + + textStyle = textStyle.copy(color = textColor), + cursorBrush = cursorBrush, decorationBox = { innerTextField -> Row( @@ -67,7 +76,7 @@ fun TerningTextField( Icon( painter = painterResource(id = it), contentDescription = null, - tint = TerningMain, + tint = iconColor, ) } Box(modifier = Modifier.weight(1f)) { @@ -80,23 +89,21 @@ fun TerningTextField( } innerTextField() } + if (showTextLength && maxTextLength != null) { + Text( + text = "${value.length}/$maxTextLength", + style = TerningTypography().button3, + color = Grey300, + ) + } } } ) - if (showTextLength && maxTextLength != null) { - Text( - text = "${value.length}/$maxTextLength", - style = TerningTypography().button3, - color = Grey300, - ) - } - - warningMessage?.let { - Text( - text = it, - style = TerningTypography().button3, - color = Color.Red, - ) - } + Text( + text = helperMessage, + modifier = Modifier.padding(vertical = 8.dp), + style = TerningTypography().detail3, + color = Grey400, + ) } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/search/SearchRoute.kt b/feature/src/main/java/com/terning/feature/search/SearchRoute.kt index 59d0503b4..b990b3b81 100644 --- a/feature/src/main/java/com/terning/feature/search/SearchRoute.kt +++ b/feature/src/main/java/com/terning/feature/search/SearchRoute.kt @@ -11,6 +11,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp +import com.terning.core.designsystem.textfield.NameTextField import com.terning.core.designsystem.textfield.SearchTextField import com.terning.feature.R @@ -36,5 +37,13 @@ fun SearchScreen() { hint = stringResource(R.string.search_text_field_hint), leftIcon = R.drawable.ic_nav_search ) + NameTextField( + text = text, + onValueChange = { newText -> + text = newText + }, + hint = stringResource(R.string.profile_text_field_hint), + helperMessage = stringResource(R.string.profile_text_field_helper) + ) } } \ No newline at end of file diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index 4193e573b..b70029ff3 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -15,6 +15,10 @@ 카카오톡 로그인에 실패했습니다 로그인을 취소하였습니다 + + 이름을 입력해주세요 + 12자리 이내, 문자/숫자 가능, 특수문자/기호 입력불가 + 이름에 특수문자는 입력할 수 없어요 관심있는 인턴 공고 키워드를 검색해보세요 \ No newline at end of file From 3e55a7ecfa745f436ee2a591086b4f8b0cbe756e Mon Sep 17 00:00:00 2001 From: arinming Date: Mon, 8 Jul 2024 01:15:11 +0900 Subject: [PATCH 5/9] =?UTF-8?q?[FEAT/#19]=20TextField=20helper=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designsystem/textfield/NameTextField.kt | 11 ++++- .../designsystem/textfield/SearchTextField.kt | 3 +- .../textfield/TerningTextField.kt | 31 ++++++++++---- .../com/terning/feature/search/SearchRoute.kt | 41 ++++++++++++++++++- feature/src/main/res/drawable/ic_check.xml | 18 ++++++++ feature/src/main/res/drawable/ic_warning.xml | 18 ++++++++ feature/src/main/res/values/strings.xml | 2 + 7 files changed, 110 insertions(+), 14 deletions(-) create mode 100644 feature/src/main/res/drawable/ic_check.xml create mode 100644 feature/src/main/res/drawable/ic_warning.xml diff --git a/core/src/main/java/com/terning/core/designsystem/textfield/NameTextField.kt b/core/src/main/java/com/terning/core/designsystem/textfield/NameTextField.kt index 23e0f7464..aa157ca16 100644 --- a/core/src/main/java/com/terning/core/designsystem/textfield/NameTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/textfield/NameTextField.kt @@ -1,9 +1,13 @@ package com.terning.core.designsystem.textfield import androidx.compose.runtime.Composable +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.SolidColor import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey300 +import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.Grey500 +import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTypography @Composable @@ -12,6 +16,8 @@ fun NameTextField( onValueChange: (String) -> Unit, hint: String, helperMessage: String, + helperIcon: Int? = null, + helperColor: Color = TerningMain, ) { TerningTextField( value = text, @@ -19,10 +25,13 @@ fun NameTextField( textStyle = TerningTypography().detail1, textColor = Black, drawLineColor = Grey500, + cursorBrush = SolidColor(Grey400), hint = hint, hintColor = Grey300, showTextLength = true, maxTextLength = 12, - helperMessage = helperMessage + helperMessage = helperMessage, + helperIcon = helperIcon, + helperColor = helperColor ) } \ No newline at end of file diff --git a/core/src/main/java/com/terning/core/designsystem/textfield/SearchTextField.kt b/core/src/main/java/com/terning/core/designsystem/textfield/SearchTextField.kt index 7f6e2c254..6b208a233 100644 --- a/core/src/main/java/com/terning/core/designsystem/textfield/SearchTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/textfield/SearchTextField.kt @@ -4,7 +4,6 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.graphics.SolidColor import com.terning.core.designsystem.theme.Grey300 import com.terning.core.designsystem.theme.Grey400 -import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTypography @Composable @@ -25,6 +24,6 @@ fun SearchTextField( hint = hint, hintColor = Grey300, leftIcon = leftIcon, - iconColor = Grey400 + leftIconColor = Grey400, ) } \ No newline at end of file diff --git a/core/src/main/java/com/terning/core/designsystem/textfield/TerningTextField.kt b/core/src/main/java/com/terning/core/designsystem/textfield/TerningTextField.kt index a4621851e..7c8daee2a 100644 --- a/core/src/main/java/com/terning/core/designsystem/textfield/TerningTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/textfield/TerningTextField.kt @@ -21,7 +21,6 @@ import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.TextStyle import androidx.compose.ui.unit.dp import com.terning.core.designsystem.theme.Grey300 -import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTypography import com.terning.core.designsystem.theme.White @@ -38,10 +37,12 @@ fun TerningTextField( strokeWidth: Float = 1f, drawLineColor: Color, leftIcon: Int? = null, - iconColor: Color = TerningMain, + leftIconColor: Color = TerningMain, maxTextLength: Int? = null, showTextLength: Boolean = false, helperMessage: String = "", + helperIcon: Int? = null, + helperColor: Color = TerningMain, ) { BasicTextField( value = value, @@ -76,7 +77,7 @@ fun TerningTextField( Icon( painter = painterResource(id = it), contentDescription = null, - tint = iconColor, + tint = leftIconColor, ) } Box(modifier = Modifier.weight(1f)) { @@ -100,10 +101,22 @@ fun TerningTextField( } ) - Text( - text = helperMessage, - modifier = Modifier.padding(vertical = 8.dp), - style = TerningTypography().detail3, - color = Grey400, - ) + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(4.dp), + modifier = Modifier.padding(vertical = 8.dp) + ) { + helperIcon?.let { + Icon( + painter = painterResource(id = it), + contentDescription = null, + tint = helperColor, + ) + } + Text( + text = helperMessage, + style = TerningTypography().detail3, + color = helperColor, + ) + } } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/search/SearchRoute.kt b/feature/src/main/java/com/terning/feature/search/SearchRoute.kt index b990b3b81..6e40562fa 100644 --- a/feature/src/main/java/com/terning/feature/search/SearchRoute.kt +++ b/feature/src/main/java/com/terning/feature/search/SearchRoute.kt @@ -13,6 +13,9 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.terning.core.designsystem.textfield.NameTextField import com.terning.core.designsystem.textfield.SearchTextField +import com.terning.core.designsystem.theme.Grey400 +import com.terning.core.designsystem.theme.TerningMain +import com.terning.core.designsystem.theme.WarningRed import com.terning.feature.R @Composable @@ -24,11 +27,40 @@ fun SearchRoute() { fun SearchScreen() { var text by remember { mutableStateOf("") } + // TODO 프로필 스크린 전용으로, 삭제될 코드입니다 + var helperMessage by remember { mutableStateOf(R.string.profile_text_field_helper) } + var helperIcon by remember { mutableStateOf(null) } + var helperColor by remember { mutableStateOf(Grey400) } + val specialCharacterPattern = Regex("[!@#\$%^&*(),.?\":{}|<>\\[\\]\\\\/]") + + // TODO 프로필 스크린 전용으로, 삭제될 코드입니다 + fun updateHelper(text: String) { + helperMessage = when { + text.isEmpty() -> R.string.profile_text_field_helper + specialCharacterPattern.containsMatchIn(text) -> R.string.profile_text_field_warning + text.length <= 12 -> R.string.profile_text_field_check + else -> R.string.profile_text_field_helper + } + helperIcon = when { + text.isEmpty() -> null + specialCharacterPattern.containsMatchIn(text) -> R.drawable.ic_warning + text.length <= 12 -> R.drawable.ic_check + else -> null + } + helperColor = when { + text.isEmpty() -> Grey400 + specialCharacterPattern.containsMatchIn(text) -> WarningRed + text.length <= 12 -> TerningMain + else -> Grey400 + } + } + Column( modifier = Modifier .fillMaxWidth() .padding(horizontal = 16.dp) ) { + SearchTextField( text = text, onValueChange = { newText -> @@ -37,13 +69,18 @@ fun SearchScreen() { hint = stringResource(R.string.search_text_field_hint), leftIcon = R.drawable.ic_nav_search ) + + // TODO 프로필 스크린 전용으로, 삭제될 코드입니다 NameTextField( text = text, onValueChange = { newText -> text = newText + updateHelper(newText) }, hint = stringResource(R.string.profile_text_field_hint), - helperMessage = stringResource(R.string.profile_text_field_helper) + helperMessage = stringResource(helperMessage), + helperIcon = helperIcon, + helperColor = helperColor ) } -} \ No newline at end of file +} diff --git a/feature/src/main/res/drawable/ic_check.xml b/feature/src/main/res/drawable/ic_check.xml new file mode 100644 index 000000000..3982b4d78 --- /dev/null +++ b/feature/src/main/res/drawable/ic_check.xml @@ -0,0 +1,18 @@ + + + + diff --git a/feature/src/main/res/drawable/ic_warning.xml b/feature/src/main/res/drawable/ic_warning.xml new file mode 100644 index 000000000..04eb2ddbe --- /dev/null +++ b/feature/src/main/res/drawable/ic_warning.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index b70029ff3..126401fa0 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -19,6 +19,8 @@ 이름을 입력해주세요 12자리 이내, 문자/숫자 가능, 특수문자/기호 입력불가 이름에 특수문자는 입력할 수 없어요 + 이용 가능한 이름이에요 + 관심있는 인턴 공고 키워드를 검색해보세요 \ No newline at end of file From 8cd06189225356dbb69ad9b1fbc5a23741317344 Mon Sep 17 00:00:00 2001 From: arinming Date: Mon, 8 Jul 2024 01:34:22 +0900 Subject: [PATCH 6/9] =?UTF-8?q?[FEAT/#19]=20=EC=99=84=EB=A3=8C=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=EC=9C=BC=EB=A1=9C=20=ED=82=A4=EB=B3=B4=EB=93=9C=20?= =?UTF-8?q?=EC=88=A8=EA=B8=B0=EA=B8=B0=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designsystem/textfield/TerningTextField.kt | 16 ++++++++++++++++ feature/src/main/AndroidManifest.xml | 1 + .../com/terning/feature/search/SearchRoute.kt | 9 ++++++--- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/textfield/TerningTextField.kt b/core/src/main/java/com/terning/core/designsystem/textfield/TerningTextField.kt index 7c8daee2a..57257cd50 100644 --- a/core/src/main/java/com/terning/core/designsystem/textfield/TerningTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/textfield/TerningTextField.kt @@ -7,6 +7,8 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.text.BasicTextField +import androidx.compose.foundation.text.KeyboardActions +import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material3.Icon import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -17,8 +19,11 @@ import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.SolidColor +import androidx.compose.ui.platform.LocalFocusManager +import androidx.compose.ui.platform.LocalSoftwareKeyboardController import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.unit.dp import com.terning.core.designsystem.theme.Grey300 import com.terning.core.designsystem.theme.TerningMain @@ -44,9 +49,20 @@ fun TerningTextField( helperIcon: Int? = null, helperColor: Color = TerningMain, ) { + val keyboardController = LocalSoftwareKeyboardController.current + val focusManager = LocalFocusManager.current + BasicTextField( value = value, onValueChange = onValueChange, + singleLine = true, + maxLines = 1, + keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done), + keyboardActions = KeyboardActions( + onDone = { + keyboardController?.hide() + focusManager.clearFocus() + }), modifier = Modifier .fillMaxWidth() diff --git a/feature/src/main/AndroidManifest.xml b/feature/src/main/AndroidManifest.xml index 1e31d319a..f136894fe 100644 --- a/feature/src/main/AndroidManifest.xml +++ b/feature/src/main/AndroidManifest.xml @@ -7,6 +7,7 @@ android:exported="true" android:label="@string/app_name" android:screenOrientation="portrait" + android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.TerningAndroid"> diff --git a/feature/src/main/java/com/terning/feature/search/SearchRoute.kt b/feature/src/main/java/com/terning/feature/search/SearchRoute.kt index 6e40562fa..734ea415d 100644 --- a/feature/src/main/java/com/terning/feature/search/SearchRoute.kt +++ b/feature/src/main/java/com/terning/feature/search/SearchRoute.kt @@ -1,5 +1,6 @@ package com.terning.feature.search +import androidx.compose.foundation.gestures.detectTapGestures import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding @@ -9,6 +10,8 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier +import androidx.compose.ui.input.pointer.pointerInput +import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.terning.core.designsystem.textfield.NameTextField @@ -27,13 +30,13 @@ fun SearchRoute() { fun SearchScreen() { var text by remember { mutableStateOf("") } - // TODO 프로필 스크린 전용으로, 삭제될 코드입니다 + // TODO 프로필 스크린 TextField로, 삭제될 코드입니다 var helperMessage by remember { mutableStateOf(R.string.profile_text_field_helper) } var helperIcon by remember { mutableStateOf(null) } var helperColor by remember { mutableStateOf(Grey400) } val specialCharacterPattern = Regex("[!@#\$%^&*(),.?\":{}|<>\\[\\]\\\\/]") - // TODO 프로필 스크린 전용으로, 삭제될 코드입니다 + // TODO 프로필 스크린 TextField로, 삭제될 코드입니다 fun updateHelper(text: String) { helperMessage = when { text.isEmpty() -> R.string.profile_text_field_helper @@ -70,7 +73,7 @@ fun SearchScreen() { leftIcon = R.drawable.ic_nav_search ) - // TODO 프로필 스크린 전용으로, 삭제될 코드입니다 + // TODO 프로필 스크린 TextField로, 삭제될 코드입니다 NameTextField( text = text, onValueChange = { newText -> From 1064dd81f514646ea5300023e6a3b1b0106c7246 Mon Sep 17 00:00:00 2001 From: arinming Date: Tue, 9 Jul 2024 01:06:31 +0900 Subject: [PATCH 7/9] =?UTF-8?q?[REFACTOR/#19]=20=ED=83=80=EC=9D=B4?= =?UTF-8?q?=ED=8F=AC=20=ED=85=8C=EB=A7=88=20=EC=A0=81=EC=9A=A9=20=EB=B0=A9?= =?UTF-8?q?=EC=8B=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designsystem/textfield/NameTextField.kt | 6 ++--- .../designsystem/textfield/SearchTextField.kt | 6 ++--- ...gTextField.kt => TerningBasicTextField.kt} | 27 ++++++++----------- .../topappbar/BackButtonTopAppBar.kt | 2 +- .../designsystem/topappbar/LogoTopAppBar.kt | 2 +- .../designsystem/topappbar/MyPageTopAppBar.kt | 6 ++--- ...gTopAppBar.kt => TerningBasicTopAppBar.kt} | 10 +++---- .../com/terning/feature/main/MainNavigator.kt | 3 ++- .../com/terning/feature/main/MainScreen.kt | 6 ++--- 9 files changed, 30 insertions(+), 38 deletions(-) rename core/src/main/java/com/terning/core/designsystem/textfield/{TerningTextField.kt => TerningBasicTextField.kt} (88%) rename core/src/main/java/com/terning/core/designsystem/topappbar/{TerningTopAppBar.kt => TerningBasicTopAppBar.kt} (82%) diff --git a/core/src/main/java/com/terning/core/designsystem/textfield/NameTextField.kt b/core/src/main/java/com/terning/core/designsystem/textfield/NameTextField.kt index aa157ca16..e13425007 100644 --- a/core/src/main/java/com/terning/core/designsystem/textfield/NameTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/textfield/NameTextField.kt @@ -8,7 +8,7 @@ import com.terning.core.designsystem.theme.Grey300 import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.Grey500 import com.terning.core.designsystem.theme.TerningMain -import com.terning.core.designsystem.theme.TerningTypography +import com.terning.core.designsystem.theme.TerningTheme @Composable fun NameTextField( @@ -19,10 +19,10 @@ fun NameTextField( helperIcon: Int? = null, helperColor: Color = TerningMain, ) { - TerningTextField( + TerningBasicTextField( value = text, onValueChange = onValueChange, - textStyle = TerningTypography().detail1, + textStyle = TerningTheme.typography.detail1, textColor = Black, drawLineColor = Grey500, cursorBrush = SolidColor(Grey400), diff --git a/core/src/main/java/com/terning/core/designsystem/textfield/SearchTextField.kt b/core/src/main/java/com/terning/core/designsystem/textfield/SearchTextField.kt index 6b208a233..aad31e85d 100644 --- a/core/src/main/java/com/terning/core/designsystem/textfield/SearchTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/textfield/SearchTextField.kt @@ -4,7 +4,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.graphics.SolidColor import com.terning.core.designsystem.theme.Grey300 import com.terning.core.designsystem.theme.Grey400 -import com.terning.core.designsystem.theme.TerningTypography +import com.terning.core.designsystem.theme.TerningTheme @Composable fun SearchTextField( @@ -13,10 +13,10 @@ fun SearchTextField( hint: String, leftIcon: Int, ) { - TerningTextField( + TerningBasicTextField( value = text, onValueChange = onValueChange, - textStyle = TerningTypography().button3, + textStyle = TerningTheme.typography.button3, textColor = Grey400, cursorBrush = SolidColor(Grey300), drawLineColor = Grey300, diff --git a/core/src/main/java/com/terning/core/designsystem/textfield/TerningTextField.kt b/core/src/main/java/com/terning/core/designsystem/textfield/TerningBasicTextField.kt similarity index 88% rename from core/src/main/java/com/terning/core/designsystem/textfield/TerningTextField.kt rename to core/src/main/java/com/terning/core/designsystem/textfield/TerningBasicTextField.kt index 57257cd50..1fbdbeed7 100644 --- a/core/src/main/java/com/terning/core/designsystem/textfield/TerningTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/textfield/TerningBasicTextField.kt @@ -27,11 +27,11 @@ import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.unit.dp import com.terning.core.designsystem.theme.Grey300 import com.terning.core.designsystem.theme.TerningMain -import com.terning.core.designsystem.theme.TerningTypography +import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.theme.White @Composable -fun TerningTextField( +fun TerningBasicTextField( value: String, onValueChange: (String) -> Unit, textStyle: TextStyle, @@ -52,17 +52,15 @@ fun TerningTextField( val keyboardController = LocalSoftwareKeyboardController.current val focusManager = LocalFocusManager.current - BasicTextField( - value = value, + BasicTextField(value = value, onValueChange = onValueChange, singleLine = true, maxLines = 1, keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done), - keyboardActions = KeyboardActions( - onDone = { - keyboardController?.hide() - focusManager.clearFocus() - }), + keyboardActions = KeyboardActions(onDone = { + keyboardController?.hide() + focusManager.clearFocus() + }), modifier = Modifier .fillMaxWidth() @@ -99,9 +97,7 @@ fun TerningTextField( Box(modifier = Modifier.weight(1f)) { if (value.isEmpty()) { Text( - text = hint, - style = textStyle, - color = hintColor + text = hint, style = textStyle, color = hintColor ) } innerTextField() @@ -109,13 +105,12 @@ fun TerningTextField( if (showTextLength && maxTextLength != null) { Text( text = "${value.length}/$maxTextLength", - style = TerningTypography().button3, + style = TerningTheme.typography.button3, color = Grey300, ) } } - } - ) + }) Row( verticalAlignment = Alignment.CenterVertically, @@ -131,7 +126,7 @@ fun TerningTextField( } Text( text = helperMessage, - style = TerningTypography().detail3, + style = TerningTheme.typography.detail3, color = helperColor, ) } diff --git a/core/src/main/java/com/terning/core/designsystem/topappbar/BackButtonTopAppBar.kt b/core/src/main/java/com/terning/core/designsystem/topappbar/BackButtonTopAppBar.kt index aeb7f1b00..8088fcab1 100644 --- a/core/src/main/java/com/terning/core/designsystem/topappbar/BackButtonTopAppBar.kt +++ b/core/src/main/java/com/terning/core/designsystem/topappbar/BackButtonTopAppBar.kt @@ -6,7 +6,7 @@ import androidx.compose.runtime.Composable fun BackButtonTopAppBar( title: String, onBackButtonClick: (() -> Unit), ) { - TerningTopAppBar( + TerningBasicTopAppBar( title = title, showBackButton = true, onBackButtonClick = { onBackButtonClick.invoke() }, diff --git a/core/src/main/java/com/terning/core/designsystem/topappbar/LogoTopAppBar.kt b/core/src/main/java/com/terning/core/designsystem/topappbar/LogoTopAppBar.kt index a5b6e68e5..c3a799393 100644 --- a/core/src/main/java/com/terning/core/designsystem/topappbar/LogoTopAppBar.kt +++ b/core/src/main/java/com/terning/core/designsystem/topappbar/LogoTopAppBar.kt @@ -8,7 +8,7 @@ import com.terning.core.R @Composable fun LogoTopAppBar() { - TerningTopAppBar( + TerningBasicTopAppBar( showBackButton = false, actions = listOf { Icon( diff --git a/core/src/main/java/com/terning/core/designsystem/topappbar/MyPageTopAppBar.kt b/core/src/main/java/com/terning/core/designsystem/topappbar/MyPageTopAppBar.kt index 295c5aabd..4afb62bc3 100644 --- a/core/src/main/java/com/terning/core/designsystem/topappbar/MyPageTopAppBar.kt +++ b/core/src/main/java/com/terning/core/designsystem/topappbar/MyPageTopAppBar.kt @@ -10,11 +10,11 @@ import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import com.terning.core.R -import com.terning.core.designsystem.theme.TerningTypography +import com.terning.core.designsystem.theme.TerningTheme @Composable fun MyPageTopAppBar() { - TerningTopAppBar( + TerningBasicTopAppBar( showBackButton = false, actions = listOf( {}, @@ -24,7 +24,7 @@ fun MyPageTopAppBar() { ) { Text( text = stringResource(id = R.string.my_page_top_app_bar), - style = TerningTypography().button3, + style = TerningTheme.typography.button3, textAlign = TextAlign.Center ) IconButton(onClick = { diff --git a/core/src/main/java/com/terning/core/designsystem/topappbar/TerningTopAppBar.kt b/core/src/main/java/com/terning/core/designsystem/topappbar/TerningBasicTopAppBar.kt similarity index 82% rename from core/src/main/java/com/terning/core/designsystem/topappbar/TerningTopAppBar.kt rename to core/src/main/java/com/terning/core/designsystem/topappbar/TerningBasicTopAppBar.kt index 0e164edc5..e1d5708df 100644 --- a/core/src/main/java/com/terning/core/designsystem/topappbar/TerningTopAppBar.kt +++ b/core/src/main/java/com/terning/core/designsystem/topappbar/TerningBasicTopAppBar.kt @@ -1,24 +1,20 @@ package com.terning.core.designsystem.topappbar -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.material3.CenterAlignedTopAppBar import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import com.terning.core.R -import com.terning.core.designsystem.theme.TerningTypography +import com.terning.core.designsystem.theme.TerningTheme @OptIn(ExperimentalMaterial3Api::class) @Composable -fun TerningTopAppBar( +fun TerningBasicTopAppBar( title: String = "", showBackButton: Boolean = false, actions: List<@Composable () -> Unit> = emptyList(), @@ -30,7 +26,7 @@ fun TerningTopAppBar( Text( text = title, textAlign = TextAlign.Center, - style = TerningTypography().title2 + style = TerningTheme.typography.title2 ) }, diff --git a/feature/src/main/java/com/terning/feature/main/MainNavigator.kt b/feature/src/main/java/com/terning/feature/main/MainNavigator.kt index e67b04927..68d33fb38 100644 --- a/feature/src/main/java/com/terning/feature/main/MainNavigator.kt +++ b/feature/src/main/java/com/terning/feature/main/MainNavigator.kt @@ -12,6 +12,7 @@ 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 @@ -22,7 +23,7 @@ class MainNavigator( @Composable get() = navController .currentBackStackEntryAsState().value?.destination - val startDestination = Search + val startDestination = SignIn val currentTab: MainTab? @Composable get() = MainTab.find { tab -> diff --git a/feature/src/main/java/com/terning/feature/main/MainScreen.kt b/feature/src/main/java/com/terning/feature/main/MainScreen.kt index 150101db0..38cdf8283 100644 --- a/feature/src/main/java/com/terning/feature/main/MainScreen.kt +++ b/feature/src/main/java/com/terning/feature/main/MainScreen.kt @@ -23,7 +23,7 @@ import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.White import com.terning.core.designsystem.topappbar.LogoTopAppBar import com.terning.core.designsystem.topappbar.MyPageTopAppBar -import com.terning.core.designsystem.topappbar.TerningTopAppBar +import com.terning.core.designsystem.topappbar.TerningBasicTopAppBar import com.terning.feature.calendar.navigation.calendarNavGraph import com.terning.feature.home.navigation.homeNavGraph import com.terning.feature.mypage.navigation.myPageNavGraph @@ -41,10 +41,10 @@ fun MainScreen( topBar = { when (navigator.currentTab) { MainTab.HOME -> LogoTopAppBar() - MainTab.CALENDAR -> TerningTopAppBar() + MainTab.CALENDAR -> TerningBasicTopAppBar() MainTab.SEARCH -> LogoTopAppBar() MainTab.MY_PAGE -> MyPageTopAppBar() - null -> TerningTopAppBar() + null -> TerningBasicTopAppBar() } }, bottomBar = { From 194e040d3a649cb131970a128739987374bee4f2 Mon Sep 17 00:00:00 2001 From: arinming Date: Tue, 9 Jul 2024 21:29:40 +0900 Subject: [PATCH 8/9] =?UTF-8?q?[REFACTOR/#19]=20=ED=8C=8C=EB=9D=BC?= =?UTF-8?q?=EB=AF=B8=ED=84=B0=20=EC=A0=95=EB=A0=AC=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../textfield/TerningBasicTextField.kt | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/textfield/TerningBasicTextField.kt b/core/src/main/java/com/terning/core/designsystem/textfield/TerningBasicTextField.kt index 1fbdbeed7..d8886a04b 100644 --- a/core/src/main/java/com/terning/core/designsystem/textfield/TerningBasicTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/textfield/TerningBasicTextField.kt @@ -18,7 +18,6 @@ import androidx.compose.ui.draw.drawWithContent import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.SolidColor import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.platform.LocalSoftwareKeyboardController import androidx.compose.ui.res.painterResource @@ -26,7 +25,6 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.unit.dp import com.terning.core.designsystem.theme.Grey300 -import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.theme.White @@ -35,19 +33,19 @@ fun TerningBasicTextField( value: String, onValueChange: (String) -> Unit, textStyle: TextStyle, - textColor: Color = TerningMain, - cursorBrush: Brush = SolidColor(TerningMain), - hint: String = "", - hintColor: Color = TerningMain, - strokeWidth: Float = 1f, + textColor: Color, + hintColor: Color, + leftIconColor: Color, drawLineColor: Color, + helperColor: Color, + cursorBrush: Brush, + strokeWidth: Float = 1f, leftIcon: Int? = null, - leftIconColor: Color = TerningMain, maxTextLength: Int? = null, showTextLength: Boolean = false, + hint: String = "", helperMessage: String = "", helperIcon: Int? = null, - helperColor: Color = TerningMain, ) { val keyboardController = LocalSoftwareKeyboardController.current val focusManager = LocalFocusManager.current @@ -97,7 +95,9 @@ fun TerningBasicTextField( Box(modifier = Modifier.weight(1f)) { if (value.isEmpty()) { Text( - text = hint, style = textStyle, color = hintColor + text = hint, + style = textStyle, + color = hintColor ) } innerTextField() From 4af24411c91ed9b0908e4a6172931a3f3be0b0cb Mon Sep 17 00:00:00 2001 From: arinming Date: Tue, 9 Jul 2024 21:46:14 +0900 Subject: [PATCH 9/9] =?UTF-8?q?[REFACTOR/#19]=20leftIconColor=20=EA=B8=B0?= =?UTF-8?q?=EB=B3=B8=EA=B0=92=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/core/designsystem/textfield/NameTextField.kt | 2 +- .../core/designsystem/textfield/TerningBasicTextField.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/textfield/NameTextField.kt b/core/src/main/java/com/terning/core/designsystem/textfield/NameTextField.kt index e13425007..6b5a9ec9a 100644 --- a/core/src/main/java/com/terning/core/designsystem/textfield/NameTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/textfield/NameTextField.kt @@ -32,6 +32,6 @@ fun NameTextField( maxTextLength = 12, helperMessage = helperMessage, helperIcon = helperIcon, - helperColor = helperColor + helperColor = helperColor, ) } \ No newline at end of file diff --git a/core/src/main/java/com/terning/core/designsystem/textfield/TerningBasicTextField.kt b/core/src/main/java/com/terning/core/designsystem/textfield/TerningBasicTextField.kt index d8886a04b..d100f999f 100644 --- a/core/src/main/java/com/terning/core/designsystem/textfield/TerningBasicTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/textfield/TerningBasicTextField.kt @@ -25,6 +25,7 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.unit.dp import com.terning.core.designsystem.theme.Grey300 +import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.theme.White @@ -35,12 +36,12 @@ fun TerningBasicTextField( textStyle: TextStyle, textColor: Color, hintColor: Color, - leftIconColor: Color, drawLineColor: Color, helperColor: Color, cursorBrush: Brush, strokeWidth: Float = 1f, leftIcon: Int? = null, + leftIconColor: Color = TerningMain, maxTextLength: Int? = null, showTextLength: Boolean = false, hint: String = "",