From 731883d45e0ca1e51d929b01ba5a6882aa6a99d2 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Wed, 10 Jul 2024 18:25:48 +0900 Subject: [PATCH 01/20] [FEAT/#14] navigateToSignUp() --- .../java/com/terning/feature/onboarding/signin/SignInRoute.kt | 3 ++- .../java/com/terning/feature/onboarding/signup/SignUpRoute.kt | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/feature/src/main/java/com/terning/feature/onboarding/signin/SignInRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/signin/SignInRoute.kt index 24be49cee..4005a88d8 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signin/SignInRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signin/SignInRoute.kt @@ -26,6 +26,7 @@ import com.terning.core.extension.toast import com.terning.feature.R import com.terning.feature.home.navigation.navigateHome import com.terning.feature.onboarding.signin.component.KakaoButton +import com.terning.feature.onboarding.signup.navigation.navigateSignUp @Composable fun SignInRoute( @@ -41,7 +42,7 @@ fun SignInRoute( .collect { sideEffect -> when (sideEffect) { is SignInSideEffect.ShowToast -> context.toast(sideEffect.message) - is SignInSideEffect.NavigateToHome -> navController.navigateHome() + is SignInSideEffect.NavigateToHome -> navController.navigateSignUp() } } } diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt index 9d3d3d411..45234f780 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt @@ -1,5 +1,6 @@ package com.terning.feature.onboarding.signup +import androidx.compose.material3.Text import androidx.compose.runtime.Composable @Composable @@ -10,4 +11,6 @@ fun SignUpRoute() { @Composable fun SignUpScreen() { + Text(text = "반가워요!\n" + + "이름을 알려주세요") } \ No newline at end of file From d101e4edf6cb4e4d4eb438d1c1b894a95c3d31bb Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Wed, 10 Jul 2024 21:08:06 +0900 Subject: [PATCH 02/20] =?UTF-8?q?[FEAT/#14]=20SignUpProfile=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 --- .../feature/onboarding/signin/SignInRoute.kt | 1 - .../feature/onboarding/signup/SignUpRoute.kt | 47 +++++++++++++++++-- .../signup/component/SignUpProfile.kt | 38 +++++++++++++++ .../main/res/drawable/ic_sign_up_button.xml | 23 +++++++++ .../main/res/drawable/ic_sign_up_profile.xml | 9 ++++ feature/src/main/res/values/strings.xml | 4 +- 6 files changed, 116 insertions(+), 6 deletions(-) create mode 100644 feature/src/main/java/com/terning/feature/onboarding/signup/component/SignUpProfile.kt create mode 100644 feature/src/main/res/drawable/ic_sign_up_button.xml create mode 100644 feature/src/main/res/drawable/ic_sign_up_profile.xml diff --git a/feature/src/main/java/com/terning/feature/onboarding/signin/SignInRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/signin/SignInRoute.kt index e188e8690..ac1bac7a8 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signin/SignInRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signin/SignInRoute.kt @@ -57,7 +57,6 @@ fun SignInScreen( modifier: Modifier = Modifier, onSignInClick: () -> Unit = {}, ) { - Column( modifier = modifier .wrapContentHeight() diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt index 45234f780..fe4f7896a 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt @@ -1,7 +1,19 @@ package com.terning.feature.onboarding.signup +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import com.terning.core.designsystem.theme.TerningPointTheme +import com.terning.core.designsystem.theme.TerningTheme +import com.terning.feature.R +import com.terning.feature.onboarding.signup.component.SignUpProfile @Composable fun SignUpRoute() { @@ -9,8 +21,35 @@ fun SignUpRoute() { } @Composable -fun SignUpScreen() { +fun SignUpScreen( + modifier: Modifier = Modifier +) { + Column( + modifier = modifier.fillMaxSize() + ) { + Spacer(modifier = Modifier.weight(1f)) + Text( + text = stringResource(id = R.string.sign_up_title), + style = TerningTheme.typography.heading2, + modifier = modifier.padding( + bottom = 42.dp, + start = 24.dp + ) + ) + Text( + text = stringResource(id = R.string.sign_up_profile_image), + style = TerningTheme.typography.body2, + modifier = modifier.padding(start = 24.dp) + ) + Spacer(modifier = modifier.weight(2f)) + SignUpProfile() + } +} - Text(text = "반가워요!\n" + - "이름을 알려주세요") -} \ No newline at end of file +@Preview(showBackground = true) +@Composable +fun SignUpScreenPreview() { + TerningPointTheme { + SignUpScreen() + } +} diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/component/SignUpProfile.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/component/SignUpProfile.kt new file mode 100644 index 000000000..8fd593bcd --- /dev/null +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/component/SignUpProfile.kt @@ -0,0 +1,38 @@ +package com.terning.feature.onboarding.signup.component + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Box +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.tooling.preview.Preview +import com.terning.feature.R + +@Composable +fun SignUpProfile( + modifier: Modifier = Modifier +) { + Box { + Image( + painterResource(id = R.drawable.ic_sign_up_profile), + contentDescription = stringResource(id = R.string.sign_up_profile_image) + ) + Box( + modifier = modifier.align(Alignment.BottomEnd) + ) { + Image( + painterResource(id = R.drawable.ic_sign_up_button), + contentDescription = stringResource(id = R.string.sign_up_profile_button), + + ) + } + } +} + +@Preview(showBackground = true) +@Composable +fun SignUpProfilePreview() { + SignUpProfile() +} \ No newline at end of file diff --git a/feature/src/main/res/drawable/ic_sign_up_button.xml b/feature/src/main/res/drawable/ic_sign_up_button.xml new file mode 100644 index 000000000..b5b8d45dd --- /dev/null +++ b/feature/src/main/res/drawable/ic_sign_up_button.xml @@ -0,0 +1,23 @@ + + + + + diff --git a/feature/src/main/res/drawable/ic_sign_up_profile.xml b/feature/src/main/res/drawable/ic_sign_up_profile.xml new file mode 100644 index 000000000..e7a473ec6 --- /dev/null +++ b/feature/src/main/res/drawable/ic_sign_up_profile.xml @@ -0,0 +1,9 @@ + + + diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index a9f7c75b8..4afdaf156 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -20,6 +20,9 @@ 프로필 이미지 선택 회원가입 바텀시트 저장하기 + 반가워요!\n이름을 알려주세요 + 프로필 이미지 + 프로필 버튼 이름을 입력해주세요 @@ -30,7 +33,6 @@ 관심있는 인턴 공고 키워드를 검색해보세요 - From bc3e526ffdf6c7d853a0675be9fb1058618ad26a Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Wed, 10 Jul 2024 22:21:31 +0900 Subject: [PATCH 03/20] [FEAT/#14] NameTextField --- .../component/textfield/NameTextField.kt | 2 +- .../component/textfield/SearchTextField.kt | 3 + .../textfield/TerningBasicTextField.kt | 5 +- .../com/terning/feature/main/MainNavigator.kt | 3 +- .../feature/onboarding/signup/SignUpRoute.kt | 105 +++++++++++++++--- .../feature/onboarding/signup/SignUpState.kt | 6 + .../onboarding/signup/SignUpViewModel.kt | 11 +- feature/src/main/res/values/strings.xml | 3 + 8 files changed, 119 insertions(+), 19 deletions(-) create mode 100644 feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt diff --git a/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt b/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt index 88d60457d..0f60be013 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt @@ -17,7 +17,7 @@ fun NameTextField( hint: String, helperMessage: String, helperIcon: Int? = null, - helperColor: Color = TerningMain, + helperColor: Color, ) { TerningBasicTextField( value = text, diff --git a/core/src/main/java/com/terning/core/designsystem/component/textfield/SearchTextField.kt b/core/src/main/java/com/terning/core/designsystem/component/textfield/SearchTextField.kt index bc065431e..8d5b92d35 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/textfield/SearchTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/textfield/SearchTextField.kt @@ -1,9 +1,11 @@ package com.terning.core.designsystem.component.textfield import androidx.compose.runtime.Composable +import androidx.compose.ui.graphics.Color 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.TerningTheme @Composable @@ -25,5 +27,6 @@ fun SearchTextField( hintColor = Grey300, leftIcon = leftIcon, leftIconColor = Grey400, + helperColor = TerningMain ) } \ No newline at end of file diff --git a/core/src/main/java/com/terning/core/designsystem/component/textfield/TerningBasicTextField.kt b/core/src/main/java/com/terning/core/designsystem/component/textfield/TerningBasicTextField.kt index 358e42b5a..a0660944a 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/textfield/TerningBasicTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/textfield/TerningBasicTextField.kt @@ -51,7 +51,7 @@ fun TerningBasicTextField( hint: String = "", helperMessage: String = "", helperIcon: Int? = null, - helperColor: Color = TerningMain, + helperColor: Color, ) { val keyboardController = LocalSoftwareKeyboardController.current val focusManager = LocalFocusManager.current @@ -124,7 +124,8 @@ fun TerningBasicTextField( ) } } - }) + } + ) Row( verticalAlignment = Alignment.CenterVertically, 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..c83fa3dbc 100644 --- a/feature/src/main/java/com/terning/feature/main/MainNavigator.kt +++ b/feature/src/main/java/com/terning/feature/main/MainNavigator.kt @@ -13,6 +13,7 @@ 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.onboarding.signup.navigation.SignUp import com.terning.feature.search.navigation.navigateSearch class MainNavigator( @@ -22,7 +23,7 @@ class MainNavigator( @Composable get() = navController .currentBackStackEntryAsState().value?.destination - val startDestination = SignIn + val startDestination = SignUp val currentTab: MainTab? @Composable get() = MainTab.find { tab -> diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt index fe4f7896a..8a5b458e3 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt @@ -6,28 +6,46 @@ import androidx.compose.foundation.layout.fillMaxSize 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.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import androidx.hilt.navigation.compose.hiltViewModel +import androidx.lifecycle.ViewModel +import com.terning.core.designsystem.component.textfield.NameTextField +import com.terning.core.designsystem.theme.Grey400 +import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningPointTheme import com.terning.core.designsystem.theme.TerningTheme +import com.terning.core.designsystem.theme.WarningRed import com.terning.feature.R import com.terning.feature.onboarding.signup.component.SignUpProfile @Composable -fun SignUpRoute() { - SignUpScreen() +fun SignUpRoute( + signUpViewModel: SignUpViewModel = hiltViewModel() +) { + SignUpScreen( + signUpViewModel = signUpViewModel + ) } @Composable fun SignUpScreen( - modifier: Modifier = Modifier + modifier: Modifier = Modifier, + signUpViewModel: SignUpViewModel ) { + val text by remember { mutableStateOf("") } + Column( modifier = modifier.fillMaxSize() ) { - Spacer(modifier = Modifier.weight(1f)) +// Spacer(modifier = Modifier.weight(1f)) Text( text = stringResource(id = R.string.sign_up_title), style = TerningTheme.typography.heading2, @@ -39,17 +57,76 @@ fun SignUpScreen( Text( text = stringResource(id = R.string.sign_up_profile_image), style = TerningTheme.typography.body2, - modifier = modifier.padding(start = 24.dp) + modifier = modifier.padding( + start = 24.dp, + bottom = 20.dp + ) + ) + Column( + modifier = modifier + .align(Alignment.CenterHorizontally) + .padding(bottom = 52.dp) + ) { + SignUpProfile() + } + Text( + text = stringResource(id = R.string.sign_up_name), + modifier = modifier.padding(bottom = 20.dp) + ) + NameTextField( + text = text, + onValueChange = { name -> + signUpViewModel.fetchName(name) + }, + hint = stringResource(id = R.string.sign_up_bottom_sheet_description), + helperMessage = stringResource( + id = R.string.sign_up_helper + ), + helperColor = Grey400 ) - Spacer(modifier = modifier.weight(2f)) - SignUpProfile() - } -} -@Preview(showBackground = true) -@Composable -fun SignUpScreenPreview() { - TerningPointTheme { - SignUpScreen() + var text by remember { mutableStateOf("") } + + // 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 프로필 스크린 TextField로, 삭제될 코드입니다 + 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 + } + } + + NameTextField( + text = text, + onValueChange = { newText -> + text = newText + updateHelper(newText) + }, + hint = stringResource(R.string.profile_text_field_hint), + helperMessage = stringResource(helperMessage), + helperIcon = helperIcon, + helperColor = helperColor + ) + + Spacer(modifier = modifier.weight(2f)) } } diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt new file mode 100644 index 000000000..4040f7614 --- /dev/null +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt @@ -0,0 +1,6 @@ +package com.terning.feature.onboarding.signup + +data class SignUpState( + val name: String = "", + val character: Int = 0 +) \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt index b0778653a..a6da40909 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt @@ -2,9 +2,18 @@ package com.terning.feature.onboarding.signup import androidx.lifecycle.ViewModel import dagger.hilt.android.lifecycle.HiltViewModel +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow import javax.inject.Inject @HiltViewModel -class SignUpViewModel @Inject constructor() : ViewModel(){ +class SignUpViewModel @Inject constructor() : ViewModel() { + private val _state: MutableStateFlow = MutableStateFlow(SignUpState()) + val state: StateFlow get() = _state.asStateFlow() + + fun fetchName(name: String) { + _state.value = _state.value.copy(name = name) + } } \ 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 4afdaf156..d4c2dcb58 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -23,6 +23,9 @@ 반가워요!\n이름을 알려주세요 프로필 이미지 프로필 버튼 + 이름 + 이름을 입력해주세요 + 12자리 이내, 문자/숫자 가능, 특수문자/기호 입력불가 이름을 입력해주세요 From b2671ce2065c46254b732dcb9b40d035c0b2fed8 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Wed, 10 Jul 2024 22:35:21 +0900 Subject: [PATCH 04/20] =?UTF-8?q?[FIX/#14]=20=EC=BB=A8=ED=94=8C=EB=A6=AD?= =?UTF-8?q?=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/search/SearchRoute.kt | 104 +++++++++--------- 1 file changed, 52 insertions(+), 52 deletions(-) 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 90701416c..dc075791f 100644 --- a/feature/src/main/java/com/terning/feature/search/SearchRoute.kt +++ b/feature/src/main/java/com/terning/feature/search/SearchRoute.kt @@ -1,8 +1,12 @@ package com.terning.feature.search +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.material3.HorizontalDivider +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -11,12 +15,14 @@ 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.component.textfield.NameTextField import com.terning.core.designsystem.component.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.core.designsystem.theme.Black +import com.terning.core.designsystem.theme.Grey100 +import com.terning.core.designsystem.theme.TerningTheme import com.terning.feature.R +import com.terning.feature.search.component.ImageSlider +import com.terning.feature.search.component.InternListType +import com.terning.feature.search.component.SearchInternList @Composable fun SearchRoute() { @@ -26,61 +32,55 @@ fun SearchRoute() { @Composable fun SearchScreen() { var text by remember { mutableStateOf("") } - - // 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 프로필 스크린 TextField로, 삭제될 코드입니다 - 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 - } - } + val images = listOf( + R.drawable.ic_nav_search, + R.drawable.ic_check, + R.drawable.ic_nav_my_page, + ) Column( modifier = Modifier .fillMaxWidth() - .padding(horizontal = 16.dp) ) { + Box( + modifier = Modifier.padding( + horizontal = 24.dp, + vertical = 16.dp + ) + ) { + SearchTextField( + text = text, + onValueChange = { newText -> + text = newText + }, + hint = stringResource(R.string.search_text_field_hint), + leftIcon = R.drawable.ic_nav_search, + readOnly = true, + ) + } - SearchTextField( - text = text, - onValueChange = { newText -> - text = newText - }, - hint = stringResource(R.string.search_text_field_hint), - leftIcon = R.drawable.ic_nav_search + ImageSlider( + images = images ) - // TODO 프로필 스크린 TextField로, 삭제될 코드입니다 - NameTextField( - text = text, - onValueChange = { newText -> - text = newText - updateHelper(newText) - }, - hint = stringResource(R.string.profile_text_field_hint), - helperMessage = stringResource(helperMessage), - helperIcon = helperIcon, - helperColor = helperColor + Spacer(modifier = Modifier.padding(8.dp)) + + Text( + text = stringResource(id = R.string.search_today_popular), + modifier = Modifier.padding( + horizontal = 24.dp, + vertical = 4.dp + ), + style = TerningTheme.typography.title1, + color = Black ) + + SearchInternList(type = InternListType.VIEW) + HorizontalDivider( + thickness = 4.dp, + modifier = Modifier.padding(vertical = 8.dp), + color = Grey100, + ) + SearchInternList(type = InternListType.SCRAP) } -} +} \ No newline at end of file From e6f35efe9b647921a52f92b57bb270e5e5bf466f Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 11 Jul 2024 03:05:49 +0900 Subject: [PATCH 05/20] =?UTF-8?q?[FEAT/#14]=20SignUpTextField=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 --- .../component/textfield/NameTextField.kt | 4 +- .../feature/onboarding/signup/SignUpRoute.kt | 74 ++++--------------- .../feature/onboarding/signup/SignUpState.kt | 1 + .../onboarding/signup/SignUpViewModel.kt | 24 +++++- feature/src/main/res/values/strings.xml | 12 +-- 5 files changed, 46 insertions(+), 69 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt b/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt index 0f60be013..fcd92faeb 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt @@ -12,7 +12,7 @@ import com.terning.core.designsystem.theme.TerningTheme @Composable fun NameTextField( - text: String, + value: String, onValueChange: (String) -> Unit, hint: String, helperMessage: String, @@ -20,7 +20,7 @@ fun NameTextField( helperColor: Color, ) { TerningBasicTextField( - value = text, + value = value, onValueChange = onValueChange, textStyle = TerningTheme.typography.detail1, textColor = Black, diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt index 8a5b458e3..d913a443a 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt @@ -9,20 +9,15 @@ 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.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource -import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel -import androidx.lifecycle.ViewModel +import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.terning.core.designsystem.component.textfield.NameTextField -import com.terning.core.designsystem.theme.Grey400 -import com.terning.core.designsystem.theme.TerningMain -import com.terning.core.designsystem.theme.TerningPointTheme import com.terning.core.designsystem.theme.TerningTheme -import com.terning.core.designsystem.theme.WarningRed import com.terning.feature.R import com.terning.feature.onboarding.signup.component.SignUpProfile @@ -30,18 +25,21 @@ import com.terning.feature.onboarding.signup.component.SignUpProfile fun SignUpRoute( signUpViewModel: SignUpViewModel = hiltViewModel() ) { + val context = LocalContext.current + val signUpState by signUpViewModel.state.collectAsStateWithLifecycle() + SignUpScreen( - signUpViewModel = signUpViewModel + signUpViewModel = signUpViewModel, + signUpState = signUpState ) } @Composable fun SignUpScreen( modifier: Modifier = Modifier, + signUpState: SignUpState, signUpViewModel: SignUpViewModel ) { - val text by remember { mutableStateOf("") } - Column( modifier = modifier.fillMaxSize() ) { @@ -73,58 +71,18 @@ fun SignUpScreen( text = stringResource(id = R.string.sign_up_name), modifier = modifier.padding(bottom = 20.dp) ) - NameTextField( - text = text, - onValueChange = { name -> - signUpViewModel.fetchName(name) - }, - hint = stringResource(id = R.string.sign_up_bottom_sheet_description), - helperMessage = stringResource( - id = R.string.sign_up_helper - ), - helperColor = Grey400 - ) - - var text by remember { mutableStateOf("") } - - // 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 프로필 스크린 TextField로, 삭제될 코드입니다 - 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 - } - } + val text by remember { mutableStateOf("") } NameTextField( - text = text, - onValueChange = { newText -> - text = newText - updateHelper(newText) + value = signUpState.name, + onValueChange = { name -> + signUpViewModel.fetchName(name) }, - hint = stringResource(R.string.profile_text_field_hint), - helperMessage = stringResource(helperMessage), - helperIcon = helperIcon, - helperColor = helperColor + hint = stringResource(id = R.string.sign_up_hint), + helperMessage = signUpViewModel.getHelper(), + helperIcon = signUpViewModel.getHelperIcon(), + helperColor = signUpViewModel.getHelperColor() ) Spacer(modifier = modifier.weight(2f)) diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt index 4040f7614..4adfa199c 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt @@ -2,5 +2,6 @@ package com.terning.feature.onboarding.signup data class SignUpState( val name: String = "", + val helper : String ="", val character: Int = 0 ) \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt index a6da40909..b57b587fe 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt @@ -1,6 +1,10 @@ package com.terning.feature.onboarding.signup +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.stringResource import androidx.lifecycle.ViewModel +import com.terning.core.designsystem.theme.TerningMain +import com.terning.feature.R import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow @@ -16,4 +20,22 @@ class SignUpViewModel @Inject constructor() : ViewModel() { fun fetchName(name: String) { _state.value = _state.value.copy(name = name) } -} \ No newline at end of file + + private val helper : String = HELPER + fun getHelper() = helper + + val color : Color = TerningMain + fun getHelperColor() = color + + val icon : Int = R.drawable.ic_warning + fun getHelperIcon() = icon + + // 컬러 가능 + + companion object{ + const val NAME_PATTERN = "[!@#\$%^&*(),.?\":{}|<>\\[\\]\\\\/]" + private const val HELPER = "12자리 이내, 문자/숫자 가능, 특수문자/기호 입력불가" + private const val HELPER_ERROR ="이름에 특수문자는 입력할 수 없어요" + private const val HELPER_AVAILABLE = "이용 가능한 이름이에요" + } +} diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index e54b6a9a5..5aebd6b89 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -25,15 +25,11 @@ 프로필 버튼 이름 이름을 입력해주세요 - 12자리 이내, 문자/숫자 가능, 특수문자/기호 입력불가 + + + - - 이름을 입력해주세요 - 12자리 이내, 문자/숫자 가능, 특수문자/기호 입력불가 - 이름에 특수문자는 입력할 수 없어요 - 이용 가능한 이름이에요 - - + 관심있는 인턴 공고 키워드를 검색해보세요 요즘 대학생들에게 인기 있는 공고 From b01077a76dcc5ec3fd0d993b4960137740b725bc Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 11 Jul 2024 03:31:13 +0900 Subject: [PATCH 06/20] =?UTF-8?q?[FEAT/#14]=20drawLineColor=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 --- .../component/textfield/NameTextField.kt | 6 +-- .../feature/onboarding/signup/SignUpRoute.kt | 44 ++++++++++--------- .../feature/onboarding/signup/SignUpState.kt | 11 ++++- feature/src/main/res/values/strings.xml | 3 -- 4 files changed, 36 insertions(+), 28 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt b/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt index fcd92faeb..d4140e180 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt @@ -7,7 +7,6 @@ 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.TerningTheme @Composable @@ -15,16 +14,17 @@ fun NameTextField( value: String, onValueChange: (String) -> Unit, hint: String, + drawLineColor : Color, helperMessage: String, - helperIcon: Int? = null, helperColor: Color, + helperIcon: Int? = null, ) { TerningBasicTextField( value = value, onValueChange = onValueChange, textStyle = TerningTheme.typography.detail1, textColor = Black, - drawLineColor = Grey500, + drawLineColor = drawLineColor, cursorBrush = SolidColor(Grey400), hint = hint, hintColor = Grey300, diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt index d913a443a..450a1cd01 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt @@ -7,8 +7,6 @@ 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.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext @@ -17,6 +15,7 @@ import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.terning.core.designsystem.component.textfield.NameTextField +import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTheme import com.terning.feature.R import com.terning.feature.onboarding.signup.component.SignUpProfile @@ -67,24 +66,29 @@ fun SignUpScreen( ) { SignUpProfile() } - Text( - text = stringResource(id = R.string.sign_up_name), - modifier = modifier.padding(bottom = 20.dp) - ) - - val text by remember { mutableStateOf("") } - - NameTextField( - value = signUpState.name, - onValueChange = { name -> - signUpViewModel.fetchName(name) - }, - hint = stringResource(id = R.string.sign_up_hint), - helperMessage = signUpViewModel.getHelper(), - helperIcon = signUpViewModel.getHelperIcon(), - helperColor = signUpViewModel.getHelperColor() - ) - + Column( + modifier = modifier + .align(Alignment.CenterHorizontally) + .padding(horizontal = 24.dp) + ) { + Text( + text = stringResource(id = R.string.sign_up_name), + modifier = modifier.padding(bottom = 20.dp) + ) + NameTextField( + value = signUpState.name, + onValueChange = { name -> + signUpViewModel.fetchName(name) + }, + hint = stringResource(id = R.string.sign_up_hint), + drawLineColor = signUpState.drawLineColor, + helperMessage = "hi", + //signUpState.helper, + helperIcon = R.drawable.ic_sign_up_button, + //signUpState.helperIcon, + helperColor = signUpState.helperColor + ) + } Spacer(modifier = modifier.weight(2f)) } } diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt index 4adfa199c..0de4ad35c 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt @@ -1,7 +1,14 @@ package com.terning.feature.onboarding.signup +import androidx.compose.ui.graphics.Color +import com.terning.core.designsystem.theme.Grey400 +import com.terning.core.designsystem.theme.Grey500 + data class SignUpState( val name: String = "", - val helper : String ="", - val character: Int = 0 + val character: Int = 0, + val drawLineColor: Color = Grey500, + val helper: String = "", + val helperIcon: Int? = null, + val helperColor: Color = Grey400, ) \ 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 5aebd6b89..e53c61881 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -25,9 +25,6 @@ 프로필 버튼 이름 이름을 입력해주세요 - - - 관심있는 인턴 공고 키워드를 검색해보세요 From 6372c07d3b0ec47b37e9198a43010fc72493ca30 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 11 Jul 2024 04:20:39 +0900 Subject: [PATCH 07/20] =?UTF-8?q?[FEAT/#14]=20=ED=9A=8C=EC=9B=90=EA=B0=80?= =?UTF-8?q?=EC=9E=85=20=ED=94=84=EB=A1=9C=ED=95=84=20=EC=9D=B4=EB=A6=84=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/onboarding/signup/SignUpRoute.kt | 9 ++-- .../feature/onboarding/signup/SignUpState.kt | 3 +- .../onboarding/signup/SignUpViewModel.kt | 50 ++++++++++++------- .../com/terning/feature/search/SearchRoute.kt | 2 +- ...{ic_check.xml => ic_sign_up_available.xml} | 0 .../{ic_warning.xml => ic_sign_up_error.xml} | 0 feature/src/main/res/values/strings.xml | 1 + 7 files changed, 38 insertions(+), 27 deletions(-) rename feature/src/main/res/drawable/{ic_check.xml => ic_sign_up_available.xml} (100%) rename feature/src/main/res/drawable/{ic_warning.xml => ic_sign_up_error.xml} (100%) diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt index 450a1cd01..ec06a8479 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt @@ -15,7 +15,6 @@ import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.terning.core.designsystem.component.textfield.NameTextField -import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTheme import com.terning.feature.R import com.terning.feature.onboarding.signup.component.SignUpProfile @@ -78,14 +77,12 @@ fun SignUpScreen( NameTextField( value = signUpState.name, onValueChange = { name -> - signUpViewModel.fetchName(name) + signUpViewModel.isInputValid(name) }, hint = stringResource(id = R.string.sign_up_hint), drawLineColor = signUpState.drawLineColor, - helperMessage = "hi", - //signUpState.helper, - helperIcon = R.drawable.ic_sign_up_button, - //signUpState.helperIcon, + helperMessage = signUpState.helper, + helperIcon = signUpState.helperIcon, helperColor = signUpState.helperColor ) } diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt index 0de4ad35c..74e036f24 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt @@ -3,12 +3,13 @@ package com.terning.feature.onboarding.signup import androidx.compose.ui.graphics.Color import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.Grey500 +import com.terning.feature.onboarding.signup.SignUpViewModel.Companion.HELPER data class SignUpState( val name: String = "", val character: Int = 0, val drawLineColor: Color = Grey500, - val helper: String = "", + val helper: String = HELPER, val helperIcon: Int? = null, val helperColor: Color = Grey400, ) \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt index b57b587fe..eeef7de08 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt @@ -1,9 +1,9 @@ package com.terning.feature.onboarding.signup -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.res.stringResource import androidx.lifecycle.ViewModel +import com.terning.core.designsystem.theme.Grey500 import com.terning.core.designsystem.theme.TerningMain +import com.terning.core.designsystem.theme.WarningRed import com.terning.feature.R import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.MutableStateFlow @@ -17,25 +17,37 @@ class SignUpViewModel @Inject constructor() : ViewModel() { private val _state: MutableStateFlow = MutableStateFlow(SignUpState()) val state: StateFlow get() = _state.asStateFlow() - fun fetchName(name: String) { - _state.value = _state.value.copy(name = name) + fun isInputValid(name: String) { + val nameErrorRegex = Regex(NAME_ERROR) + + when { + nameErrorRegex.containsMatchIn(name) -> _state.value = _state.value.copy( + name = name, + helper = HELPER_ERROR, + helperIcon = R.drawable.ic_sign_up_error, + helperColor = WarningRed + ) + + name.isEmpty() -> _state.value = _state.value.copy( + name = name, + helper = HELPER, + helperIcon = null, + helperColor = Grey500 + ) + + else -> _state.value = _state.value.copy( + name = name, + helper = HELPER_AVAILABLE, + helperIcon = R.drawable.ic_sign_up_available, + helperColor = TerningMain + ) + } } - private val helper : String = HELPER - fun getHelper() = helper - - val color : Color = TerningMain - fun getHelperColor() = color - - val icon : Int = R.drawable.ic_warning - fun getHelperIcon() = icon - - // 컬러 가능 - - companion object{ - const val NAME_PATTERN = "[!@#\$%^&*(),.?\":{}|<>\\[\\]\\\\/]" - private const val HELPER = "12자리 이내, 문자/숫자 가능, 특수문자/기호 입력불가" - private const val HELPER_ERROR ="이름에 특수문자는 입력할 수 없어요" + companion object { + const val NAME_ERROR = "[!@#\$%^&*(),.?\":{}|<>\\[\\]\\\\/]" + const val HELPER = "12자리 이내, 문자/숫자 가능, 특수문자/기호 입력불가" + private const val HELPER_ERROR = "이름에 특수문자는 입력할 수 없어요" private const val HELPER_AVAILABLE = "이용 가능한 이름이에요" } } 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 dc075791f..2d78d33c7 100644 --- a/feature/src/main/java/com/terning/feature/search/SearchRoute.kt +++ b/feature/src/main/java/com/terning/feature/search/SearchRoute.kt @@ -34,7 +34,7 @@ fun SearchScreen() { var text by remember { mutableStateOf("") } val images = listOf( R.drawable.ic_nav_search, - R.drawable.ic_check, + R.drawable.ic_sign_up_available, R.drawable.ic_nav_my_page, ) diff --git a/feature/src/main/res/drawable/ic_check.xml b/feature/src/main/res/drawable/ic_sign_up_available.xml similarity index 100% rename from feature/src/main/res/drawable/ic_check.xml rename to feature/src/main/res/drawable/ic_sign_up_available.xml diff --git a/feature/src/main/res/drawable/ic_warning.xml b/feature/src/main/res/drawable/ic_sign_up_error.xml similarity index 100% rename from feature/src/main/res/drawable/ic_warning.xml rename to feature/src/main/res/drawable/ic_sign_up_error.xml diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index e53c61881..ee4a8b1ab 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -25,6 +25,7 @@ 프로필 버튼 이름 이름을 입력해주세요 + 12자리 이내, 문자/숫자 가능, 특수문자/기호 입력불가 관심있는 인턴 공고 키워드를 검색해보세요 From c2d1b25077e60dfc7e73671609ed5c80232b4ef2 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 11 Jul 2024 04:28:01 +0900 Subject: [PATCH 08/20] =?UTF-8?q?[FEAT/#14]=20drawLineColor=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 --- .../terning/feature/onboarding/signup/SignUpViewModel.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt index eeef7de08..9b9137d78 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt @@ -1,6 +1,7 @@ package com.terning.feature.onboarding.signup import androidx.lifecycle.ViewModel +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.WarningRed @@ -23,6 +24,7 @@ class SignUpViewModel @Inject constructor() : ViewModel() { when { nameErrorRegex.containsMatchIn(name) -> _state.value = _state.value.copy( name = name, + drawLineColor = WarningRed, helper = HELPER_ERROR, helperIcon = R.drawable.ic_sign_up_error, helperColor = WarningRed @@ -30,13 +32,15 @@ class SignUpViewModel @Inject constructor() : ViewModel() { name.isEmpty() -> _state.value = _state.value.copy( name = name, + drawLineColor = Grey500, helper = HELPER, helperIcon = null, - helperColor = Grey500 + helperColor = Grey400 ) else -> _state.value = _state.value.copy( name = name, + drawLineColor = TerningMain, helper = HELPER_AVAILABLE, helperIcon = R.drawable.ic_sign_up_available, helperColor = TerningMain From f9dbc60369ff6abf6355507cfb92d493c53ea2e3 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 11 Jul 2024 06:19:06 +0900 Subject: [PATCH 09/20] =?UTF-8?q?[FEAT/#14]=20=ED=9A=8C=EC=9B=90=EA=B0=80?= =?UTF-8?q?=EC=9E=85=20UI=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/textfield/NameTextField.kt | 3 +- .../com/terning/feature/main/MainScreen.kt | 4 ++- .../onboarding/filtering/FilteringRoute.kt | 14 +++++++-- .../navigation/FilteringNavigation.kt | 30 +++++++++++++++++-- .../signin/navigation/SignInNavigation.kt | 4 +-- .../feature/onboarding/signup/SignUpRoute.kt | 25 ++++++++++++---- .../signup/navigation/SignUpNavigation.kt | 10 +++++-- feature/src/main/res/values/strings.xml | 1 + 8 files changed, 72 insertions(+), 19 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt b/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt index d4140e180..19336ee0a 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt @@ -6,7 +6,6 @@ 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.TerningTheme @Composable @@ -14,7 +13,7 @@ fun NameTextField( value: String, onValueChange: (String) -> Unit, hint: String, - drawLineColor : Color, + drawLineColor: Color, helperMessage: String, helperColor: Color, helperIcon: Int? = null, 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 4ec98081e..28b119120 100644 --- a/feature/src/main/java/com/terning/feature/main/MainScreen.kt +++ b/feature/src/main/java/com/terning/feature/main/MainScreen.kt @@ -26,6 +26,7 @@ import com.terning.core.util.NoRippleInteractionSource import com.terning.feature.calendar.navigation.calendarNavGraph import com.terning.feature.home.navigation.homeNavGraph import com.terning.feature.mypage.navigation.myPageNavGraph +import com.terning.feature.onboarding.filtering.navigation.filteringNavGraph import com.terning.feature.onboarding.signin.navigation.signInNavGraph import com.terning.feature.onboarding.signup.navigation.signUpNavGraph import com.terning.feature.search.navigation.searchNavGraph @@ -67,7 +68,8 @@ fun MainScreen( searchNavGraph() myPageNavGraph() signInNavGraph(navHostController = navigator.navController) - signUpNavGraph() + signUpNavGraph(navHostController = navigator.navController) + filteringNavGraph(navHostController = navigator.navController) } } } diff --git a/feature/src/main/java/com/terning/feature/onboarding/filtering/FilteringRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/filtering/FilteringRoute.kt index bf1e1ec23..f4c413bba 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/filtering/FilteringRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/filtering/FilteringRoute.kt @@ -1,9 +1,17 @@ package com.terning.feature.onboarding.filtering +import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import com.terning.feature.onboarding.filtering.navigation.FilteringNavigation +import androidx.navigation.NavController @Composable -fun FilteringRoute(){ +fun FilteringRoute( + navController: NavController +) { + FilteringScreen() +} -} \ No newline at end of file +@Composable +fun FilteringScreen() { + Text(text = "filtering") +} diff --git a/feature/src/main/java/com/terning/feature/onboarding/filtering/navigation/FilteringNavigation.kt b/feature/src/main/java/com/terning/feature/onboarding/filtering/navigation/FilteringNavigation.kt index 6dcc12e7b..e69874fbd 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/filtering/navigation/FilteringNavigation.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/filtering/navigation/FilteringNavigation.kt @@ -1,4 +1,30 @@ package com.terning.feature.onboarding.filtering.navigation -class FilteringNavigation { -} \ No newline at end of file +import androidx.navigation.NavController +import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavHostController +import androidx.navigation.NavOptions +import androidx.navigation.compose.composable +import com.terning.core.navigation.Route +import com.terning.feature.onboarding.filtering.FilteringRoute +import kotlinx.serialization.Serializable + +fun NavController.navigateFiltering(navOptions: NavOptions? = null) { + navigate( + route = Filtering, + navOptions = navOptions + ) +} + +fun NavGraphBuilder.filteringNavGraph( + navHostController: NavHostController +) { + composable { + FilteringRoute( + navController = navHostController + ) + } +} + +@Serializable +data object Filtering : Route \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/onboarding/signin/navigation/SignInNavigation.kt b/feature/src/main/java/com/terning/feature/onboarding/signin/navigation/SignInNavigation.kt index 0c3d35760..cba8bfc7c 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signin/navigation/SignInNavigation.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signin/navigation/SignInNavigation.kt @@ -5,7 +5,7 @@ import androidx.navigation.NavGraphBuilder import androidx.navigation.NavHostController import androidx.navigation.NavOptions import androidx.navigation.compose.composable -import com.terning.core.navigation.MainTabRoute +import com.terning.core.navigation.Route import com.terning.feature.onboarding.signin.SignInRoute import kotlinx.serialization.Serializable @@ -27,4 +27,4 @@ fun NavGraphBuilder.signInNavGraph( } @Serializable -data object SignIn : MainTabRoute \ No newline at end of file +data object SignIn : Route \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt index ec06a8479..d008289c8 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt @@ -14,21 +14,26 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle +import androidx.navigation.NavController +import com.terning.core.designsystem.component.button.RectangleButton import com.terning.core.designsystem.component.textfield.NameTextField import com.terning.core.designsystem.theme.TerningTheme import com.terning.feature.R +import com.terning.feature.onboarding.filtering.navigation.navigateFiltering import com.terning.feature.onboarding.signup.component.SignUpProfile +import com.terning.feature.onboarding.signup.navigation.navigateSignUp @Composable fun SignUpRoute( - signUpViewModel: SignUpViewModel = hiltViewModel() + signUpViewModel: SignUpViewModel = hiltViewModel(), + navController: NavController ) { - val context = LocalContext.current val signUpState by signUpViewModel.state.collectAsStateWithLifecycle() SignUpScreen( signUpViewModel = signUpViewModel, - signUpState = signUpState + signUpState = signUpState, + onButtonClick = { navController.navigateFiltering() } ) } @@ -36,12 +41,13 @@ fun SignUpRoute( fun SignUpScreen( modifier: Modifier = Modifier, signUpState: SignUpState, - signUpViewModel: SignUpViewModel + signUpViewModel: SignUpViewModel, + onButtonClick : () -> Unit ) { Column( modifier = modifier.fillMaxSize() ) { -// Spacer(modifier = Modifier.weight(1f)) + Spacer(modifier = modifier.weight(1f)) Text( text = stringResource(id = R.string.sign_up_title), style = TerningTheme.typography.heading2, @@ -86,6 +92,13 @@ fun SignUpScreen( helperColor = signUpState.helperColor ) } - Spacer(modifier = modifier.weight(2f)) + Spacer(modifier = modifier.weight(5f)) + RectangleButton( + style = TerningTheme.typography.button1, + paddingVertical = 20.dp, + text = R.string.sign_up_next_button, + onButtonClick = { onButtonClick() }, + modifier = modifier.padding(bottom = 12.dp) + ) } } diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/navigation/SignUpNavigation.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/navigation/SignUpNavigation.kt index 1379d0a64..b8c4bf412 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/navigation/SignUpNavigation.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/navigation/SignUpNavigation.kt @@ -2,9 +2,11 @@ package com.terning.feature.onboarding.signup.navigation import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavHostController import androidx.navigation.NavOptions import androidx.navigation.compose.composable import com.terning.core.navigation.MainTabRoute +import com.terning.core.navigation.Route import com.terning.feature.onboarding.signup.SignUpRoute import kotlinx.serialization.Serializable @@ -15,11 +17,13 @@ fun NavController.navigateSignUp(navOptions: NavOptions? = null) { ) } -fun NavGraphBuilder.signUpNavGraph() { +fun NavGraphBuilder.signUpNavGraph( + navHostController: NavHostController +) { composable { - SignUpRoute() + SignUpRoute(navController = navHostController) } } @Serializable -data object SignUp : MainTabRoute \ No newline at end of file +data object SignUp : Route \ 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 ee4a8b1ab..0cb029fe5 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -26,6 +26,7 @@ 이름 이름을 입력해주세요 12자리 이내, 문자/숫자 가능, 특수문자/기호 입력불가 + 다음으로 관심있는 인턴 공고 키워드를 검색해보세요 From fc58c97eb79a5107449ad81bc17d18d3746fa795 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 11 Jul 2024 06:24:17 +0900 Subject: [PATCH 10/20] =?UTF-8?q?[FEAT/#14]=20RectangleButton=20=ED=99=9C?= =?UTF-8?q?=EC=84=B1=ED=99=94,=20=EB=B9=84=ED=99=9C=EC=84=B1=ED=99=94=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/onboarding/signup/SignUpRoute.kt | 7 +++---- .../com/terning/feature/onboarding/signup/SignUpState.kt | 1 + .../terning/feature/onboarding/signup/SignUpViewModel.kt | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt index d008289c8..568155aff 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt @@ -9,7 +9,6 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel @@ -21,7 +20,6 @@ import com.terning.core.designsystem.theme.TerningTheme import com.terning.feature.R import com.terning.feature.onboarding.filtering.navigation.navigateFiltering import com.terning.feature.onboarding.signup.component.SignUpProfile -import com.terning.feature.onboarding.signup.navigation.navigateSignUp @Composable fun SignUpRoute( @@ -42,7 +40,7 @@ fun SignUpScreen( modifier: Modifier = Modifier, signUpState: SignUpState, signUpViewModel: SignUpViewModel, - onButtonClick : () -> Unit + onButtonClick: () -> Unit ) { Column( modifier = modifier.fillMaxSize() @@ -98,7 +96,8 @@ fun SignUpScreen( paddingVertical = 20.dp, text = R.string.sign_up_next_button, onButtonClick = { onButtonClick() }, - modifier = modifier.padding(bottom = 12.dp) + modifier = modifier.padding(bottom = 12.dp), + isEnabled = signUpState.isButtonValid ) } } diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt index 74e036f24..b6a1e59fb 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt @@ -12,4 +12,5 @@ data class SignUpState( val helper: String = HELPER, val helperIcon: Int? = null, val helperColor: Color = Grey400, + val isButtonValid : Boolean = false ) \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt index 9b9137d78..a20c01209 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt @@ -43,7 +43,8 @@ class SignUpViewModel @Inject constructor() : ViewModel() { drawLineColor = TerningMain, helper = HELPER_AVAILABLE, helperIcon = R.drawable.ic_sign_up_available, - helperColor = TerningMain + helperColor = TerningMain, + isButtonValid = true ) } } From 0106f8e914a0d6147aa3cbb8792af891f544476d Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 11 Jul 2024 06:50:26 +0900 Subject: [PATCH 11/20] =?UTF-8?q?[FEAT/#14]=20SignUpBottomSheet=20?= =?UTF-8?q?=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/onboarding/signup/SignUpRoute.kt | 27 +++++++++++++++---- .../signup/component/SignUpBottomSheet.kt | 4 +-- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt index 568155aff..34fa1fa1c 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt @@ -7,6 +7,9 @@ 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.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource @@ -17,8 +20,10 @@ import androidx.navigation.NavController import com.terning.core.designsystem.component.button.RectangleButton import com.terning.core.designsystem.component.textfield.NameTextField import com.terning.core.designsystem.theme.TerningTheme +import com.terning.core.extension.noRippleClickable import com.terning.feature.R import com.terning.feature.onboarding.filtering.navigation.navigateFiltering +import com.terning.feature.onboarding.signup.component.SignUpBottomSheet import com.terning.feature.onboarding.signup.component.SignUpProfile @Composable @@ -42,6 +47,7 @@ fun SignUpScreen( signUpViewModel: SignUpViewModel, onButtonClick: () -> Unit ) { + var showBottomSheet by remember { mutableStateOf(false) } Column( modifier = modifier.fillMaxSize() ) { @@ -54,20 +60,31 @@ fun SignUpScreen( start = 24.dp ) ) + if (showBottomSheet) { + SignUpBottomSheet( + onDismiss = { showBottomSheet = false }, + onSaveClick = { showBottomSheet = false } + ) + } Text( text = stringResource(id = R.string.sign_up_profile_image), style = TerningTheme.typography.body2, - modifier = modifier.padding( - start = 24.dp, - bottom = 20.dp - ) + modifier = modifier + .padding( + start = 24.dp, + bottom = 20.dp + ) ) Column( modifier = modifier .align(Alignment.CenterHorizontally) .padding(bottom = 52.dp) ) { - SignUpProfile() + SignUpProfile( + modifier = modifier.noRippleClickable { + showBottomSheet = true + } + ) } Column( modifier = modifier diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/component/SignUpBottomSheet.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/component/SignUpBottomSheet.kt index 1cd62a4be..79cdafd95 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/component/SignUpBottomSheet.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/component/SignUpBottomSheet.kt @@ -29,7 +29,7 @@ import com.terning.feature.R fun SignUpBottomSheet( modifier: Modifier = Modifier, onDismiss: () -> Unit, - onStartDialog: () -> Unit + onSaveClick: () -> Unit ) { TerningBasicBottomSheet( content = { @@ -50,7 +50,7 @@ fun SignUpBottomSheet( paddingVertical = 19.dp, cornerRadius = 10.dp, text = R.string.sign_up_dialog_start, - onButtonClick = { onStartDialog() }, + onButtonClick = { onSaveClick() }, modifier = modifier.padding(horizontal = 24.dp) ) Spacer(modifier = modifier.padding(bottom = 15.dp)) From e7b273a9ce7731dadd48e2352cb2df0bf9c0b5a5 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 11 Jul 2024 07:09:25 +0900 Subject: [PATCH 12/20] =?UTF-8?q?[FEAT/#14]=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=EC=84=B8=EB=B0=80=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/onboarding/signup/SignUpRoute.kt | 7 ++++++- .../terning/feature/onboarding/signup/SignUpViewModel.kt | 6 ++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt index 34fa1fa1c..1dce2b652 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt @@ -12,6 +12,7 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel @@ -20,6 +21,7 @@ import androidx.navigation.NavController import com.terning.core.designsystem.component.button.RectangleButton import com.terning.core.designsystem.component.textfield.NameTextField import com.terning.core.designsystem.theme.TerningTheme +import com.terning.core.extension.addFocusCleaner import com.terning.core.extension.noRippleClickable import com.terning.feature.R import com.terning.feature.onboarding.filtering.navigation.navigateFiltering @@ -47,9 +49,12 @@ fun SignUpScreen( signUpViewModel: SignUpViewModel, onButtonClick: () -> Unit ) { + val focusManager = LocalFocusManager.current var showBottomSheet by remember { mutableStateOf(false) } Column( - modifier = modifier.fillMaxSize() + modifier = modifier + .fillMaxSize() + .addFocusCleaner(focusManager) ) { Spacer(modifier = modifier.weight(1f)) Text( diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt index a20c01209..1fc7b8a59 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt @@ -27,7 +27,8 @@ class SignUpViewModel @Inject constructor() : ViewModel() { drawLineColor = WarningRed, helper = HELPER_ERROR, helperIcon = R.drawable.ic_sign_up_error, - helperColor = WarningRed + helperColor = WarningRed, + isButtonValid = false ) name.isEmpty() -> _state.value = _state.value.copy( @@ -35,7 +36,8 @@ class SignUpViewModel @Inject constructor() : ViewModel() { drawLineColor = Grey500, helper = HELPER, helperIcon = null, - helperColor = Grey400 + helperColor = Grey400, + isButtonValid = false ) else -> _state.value = _state.value.copy( From ee0ca25ef4a4faf4240a175a2b5493ce9424f550 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 11 Jul 2024 07:12:51 +0900 Subject: [PATCH 13/20] =?UTF-8?q?[FEAT/#14]=20startDestination=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/terning/feature/main/MainNavigator.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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 1a232687f..beb7b7920 100644 --- a/feature/src/main/java/com/terning/feature/main/MainNavigator.kt +++ b/feature/src/main/java/com/terning/feature/main/MainNavigator.kt @@ -13,8 +13,6 @@ 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.onboarding.signup.navigation.SignUp -import com.terning.feature.search.navigation.Search import com.terning.feature.search.navigation.navigateSearch class MainNavigator( @@ -24,7 +22,7 @@ class MainNavigator( @Composable get() = navController .currentBackStackEntryAsState().value?.destination - val startDestination = SignUp + val startDestination = SignIn val currentTab: MainTab? @Composable get() = MainTab.find { tab -> From f925bb47c5104784ab6ac3c178fafd00159d98cc Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 11 Jul 2024 07:32:38 +0900 Subject: [PATCH 14/20] =?UTF-8?q?[CHORE/#14]=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=A4=84=EB=B0=94=EA=BF=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/terning/feature/onboarding/signup/SignUpRoute.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt index 1dce2b652..292fed298 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt @@ -51,6 +51,7 @@ fun SignUpScreen( ) { val focusManager = LocalFocusManager.current var showBottomSheet by remember { mutableStateOf(false) } + Column( modifier = modifier .fillMaxSize() From 02e7a05e5c811ea625d819dbe52a5cd6cb160266 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 11 Jul 2024 07:43:30 +0900 Subject: [PATCH 15/20] =?UTF-8?q?[FEAT/#14]=20=EA=B8=80=EC=9E=90=EC=88=98?= =?UTF-8?q?=20=EC=A0=9C=ED=95=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/onboarding/signup/SignUpViewModel.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt index 1fc7b8a59..1afd647bb 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt @@ -20,10 +20,11 @@ class SignUpViewModel @Inject constructor() : ViewModel() { fun isInputValid(name: String) { val nameErrorRegex = Regex(NAME_ERROR) + val trimmedName = if (name.length > MAX_LENGTH) name.substring(0, MAX_LENGTH) else name when { - nameErrorRegex.containsMatchIn(name) -> _state.value = _state.value.copy( - name = name, + nameErrorRegex.containsMatchIn(trimmedName) -> _state.value = _state.value.copy( + name = trimmedName, drawLineColor = WarningRed, helper = HELPER_ERROR, helperIcon = R.drawable.ic_sign_up_error, @@ -31,8 +32,8 @@ class SignUpViewModel @Inject constructor() : ViewModel() { isButtonValid = false ) - name.isEmpty() -> _state.value = _state.value.copy( - name = name, + trimmedName.isEmpty() -> _state.value = _state.value.copy( + name = trimmedName, drawLineColor = Grey500, helper = HELPER, helperIcon = null, @@ -41,7 +42,7 @@ class SignUpViewModel @Inject constructor() : ViewModel() { ) else -> _state.value = _state.value.copy( - name = name, + name = trimmedName, drawLineColor = TerningMain, helper = HELPER_AVAILABLE, helperIcon = R.drawable.ic_sign_up_available, @@ -54,6 +55,7 @@ class SignUpViewModel @Inject constructor() : ViewModel() { companion object { const val NAME_ERROR = "[!@#\$%^&*(),.?\":{}|<>\\[\\]\\\\/]" const val HELPER = "12자리 이내, 문자/숫자 가능, 특수문자/기호 입력불가" + private const val MAX_LENGTH = 12 private const val HELPER_ERROR = "이름에 특수문자는 입력할 수 없어요" private const val HELPER_AVAILABLE = "이용 가능한 이름이에요" } From cb3b7a06341ee6679d0af2b305cbec099a0840e9 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 11 Jul 2024 22:15:38 +0900 Subject: [PATCH 16/20] [FIX/#14] solving conflict --- .../designsystem/component/topappbar/TerningBasicTopAppBar.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/terning/core/designsystem/component/topappbar/TerningBasicTopAppBar.kt b/core/src/main/java/com/terning/core/designsystem/component/topappbar/TerningBasicTopAppBar.kt index 2f6e297ad..cabda466c 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/topappbar/TerningBasicTopAppBar.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/topappbar/TerningBasicTopAppBar.kt @@ -43,7 +43,8 @@ fun TerningBasicTopAppBar( IconButton( onClick = { onBackButtonClick.invoke() - }) { + } + ) { Icon( painter = painterResource(id = R.drawable.ic_back), contentDescription = stringResource(id = R.string.ic_back), From af144e747050c63d327e9ba2e25910d25c656098 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 11 Jul 2024 22:18:33 +0900 Subject: [PATCH 17/20] =?UTF-8?q?[FEAT/#14]=20=EB=B9=84=ED=99=9C=EC=84=B1?= =?UTF-8?q?=ED=99=94=20=EB=B2=84=ED=8A=BC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/designsystem/component/button/TerningBasicButton.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/component/button/TerningBasicButton.kt b/core/src/main/java/com/terning/core/designsystem/component/button/TerningBasicButton.kt index ed923e9bd..cc4f86985 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/button/TerningBasicButton.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/button/TerningBasicButton.kt @@ -5,7 +5,6 @@ import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.interaction.collectIsPressedAsState import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding import androidx.compose.material.ripple.LocalRippleTheme import androidx.compose.material3.Button import androidx.compose.material3.ButtonDefaults @@ -22,8 +21,8 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.terning.core.R -import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey150 +import com.terning.core.designsystem.theme.Grey350 import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningMain2 import com.terning.core.designsystem.theme.TerningPointTheme @@ -55,7 +54,7 @@ fun TerningBasicButton( containerColor = backgroundColor, contentColor = White, disabledContainerColor = Grey150, - disabledContentColor = Black + disabledContentColor = Grey350 ), shape = shape, onClick = { onButtonClick() } From 4ab493f647bc4cb0339bc6027b9ea436958c425a Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 11 Jul 2024 22:45:25 +0900 Subject: [PATCH 18/20] =?UTF-8?q?[MOVE/#14]=20bottom=20sheet=20=EC=9C=84?= =?UTF-8?q?=EC=B9=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designsystem/component/bottomsheet}/SignUpBottomSheet.kt | 5 ++--- {feature => core}/src/main/res/drawable/ic_character1.xml | 0 {feature => core}/src/main/res/drawable/ic_character2.xml | 0 {feature => core}/src/main/res/drawable/ic_character3.xml | 0 {feature => core}/src/main/res/drawable/ic_character4.xml | 0 {feature => core}/src/main/res/drawable/ic_character5.xml | 0 {feature => core}/src/main/res/drawable/ic_character6.xml | 0 .../src/main/res/drawable/ic_selected_character.xml | 0 core/src/main/res/values/strings.xml | 5 +++++ .../src/main/java/com/terning/feature/main/MainNavigator.kt | 3 ++- .../com/terning/feature/onboarding/signup/SignUpRoute.kt | 2 +- feature/src/main/res/values/strings.xml | 3 --- 12 files changed, 10 insertions(+), 8 deletions(-) rename {feature/src/main/java/com/terning/feature/onboarding/signup/component => core/src/main/java/com/terning/core/designsystem/component/bottomsheet}/SignUpBottomSheet.kt (95%) rename {feature => core}/src/main/res/drawable/ic_character1.xml (100%) rename {feature => core}/src/main/res/drawable/ic_character2.xml (100%) rename {feature => core}/src/main/res/drawable/ic_character3.xml (100%) rename {feature => core}/src/main/res/drawable/ic_character4.xml (100%) rename {feature => core}/src/main/res/drawable/ic_character5.xml (100%) rename {feature => core}/src/main/res/drawable/ic_character6.xml (100%) rename {feature => core}/src/main/res/drawable/ic_selected_character.xml (100%) diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/component/SignUpBottomSheet.kt b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SignUpBottomSheet.kt similarity index 95% rename from feature/src/main/java/com/terning/feature/onboarding/signup/component/SignUpBottomSheet.kt rename to core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SignUpBottomSheet.kt index f4491fc06..638d60b61 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/component/SignUpBottomSheet.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SignUpBottomSheet.kt @@ -1,4 +1,4 @@ -package com.terning.feature.onboarding.signup.component +package com.terning.core.designsystem.component.bottomsheet import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Arrangement @@ -20,11 +20,10 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp -import com.terning.core.designsystem.component.bottomsheet.TerningBasicBottomSheet +import com.terning.core.R import com.terning.core.designsystem.component.button.RoundButton import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.extension.noRippleClickable -import com.terning.feature.R @OptIn(ExperimentalMaterial3Api::class) @Composable diff --git a/feature/src/main/res/drawable/ic_character1.xml b/core/src/main/res/drawable/ic_character1.xml similarity index 100% rename from feature/src/main/res/drawable/ic_character1.xml rename to core/src/main/res/drawable/ic_character1.xml diff --git a/feature/src/main/res/drawable/ic_character2.xml b/core/src/main/res/drawable/ic_character2.xml similarity index 100% rename from feature/src/main/res/drawable/ic_character2.xml rename to core/src/main/res/drawable/ic_character2.xml diff --git a/feature/src/main/res/drawable/ic_character3.xml b/core/src/main/res/drawable/ic_character3.xml similarity index 100% rename from feature/src/main/res/drawable/ic_character3.xml rename to core/src/main/res/drawable/ic_character3.xml diff --git a/feature/src/main/res/drawable/ic_character4.xml b/core/src/main/res/drawable/ic_character4.xml similarity index 100% rename from feature/src/main/res/drawable/ic_character4.xml rename to core/src/main/res/drawable/ic_character4.xml diff --git a/feature/src/main/res/drawable/ic_character5.xml b/core/src/main/res/drawable/ic_character5.xml similarity index 100% rename from feature/src/main/res/drawable/ic_character5.xml rename to core/src/main/res/drawable/ic_character5.xml diff --git a/feature/src/main/res/drawable/ic_character6.xml b/core/src/main/res/drawable/ic_character6.xml similarity index 100% rename from feature/src/main/res/drawable/ic_character6.xml rename to core/src/main/res/drawable/ic_character6.xml diff --git a/feature/src/main/res/drawable/ic_selected_character.xml b/core/src/main/res/drawable/ic_selected_character.xml similarity index 100% rename from feature/src/main/res/drawable/ic_selected_character.xml rename to core/src/main/res/drawable/ic_selected_character.xml diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index faa2d3afc..3de74512c 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -20,4 +20,9 @@ 정렬 기준 공고 정렬 순서 + + 프로필 이미지 선택 + 회원가입 바텀시트 + 저장하기 + \ 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 859ae0c3a..3b5a56e24 100644 --- a/feature/src/main/java/com/terning/feature/main/MainNavigator.kt +++ b/feature/src/main/java/com/terning/feature/main/MainNavigator.kt @@ -13,6 +13,7 @@ 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.onboarding.signup.navigation.SignUp import com.terning.feature.search.search.navigation.navigateSearch class MainNavigator( @@ -22,7 +23,7 @@ class MainNavigator( @Composable get() = navController .currentBackStackEntryAsState().value?.destination - val startDestination = SignIn + val startDestination = SignUp val currentTab: MainTab? @Composable get() = MainTab.find { tab -> diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt index 292fed298..a85d688f2 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt @@ -25,7 +25,7 @@ import com.terning.core.extension.addFocusCleaner import com.terning.core.extension.noRippleClickable import com.terning.feature.R import com.terning.feature.onboarding.filtering.navigation.navigateFiltering -import com.terning.feature.onboarding.signup.component.SignUpBottomSheet +import com.terning.core.designsystem.component.bottomsheet.SignUpBottomSheet import com.terning.feature.onboarding.signup.component.SignUpProfile @Composable diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index ea012c692..390a5972c 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -17,9 +17,6 @@ 로그인을 취소하였습니다 - 프로필 이미지 선택 - 회원가입 바텀시트 - 저장하기 반가워요!\n이름을 알려주세요 프로필 이미지 프로필 버튼 From 0c69b820beac8bb0972688dc2c5df4c844c346c1 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 11 Jul 2024 22:49:24 +0900 Subject: [PATCH 19/20] =?UTF-8?q?[FEAT/#14]=20bottom=20sheet=20=EC=82=AC?= =?UTF-8?q?=EB=9D=BC=EC=A7=80=EB=8A=94=20=EC=95=A0=EB=8B=88=EB=A9=94?= =?UTF-8?q?=EC=9D=B4=EC=85=98=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/bottomsheet/SignUpBottomSheet.kt | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SignUpBottomSheet.kt b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SignUpBottomSheet.kt index 638d60b61..3ac38ff49 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SignUpBottomSheet.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SignUpBottomSheet.kt @@ -11,9 +11,11 @@ import androidx.compose.foundation.lazy.grid.LazyVerticalGrid import androidx.compose.foundation.lazy.grid.items import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Text +import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableIntStateOf +import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier @@ -24,6 +26,7 @@ import com.terning.core.R import com.terning.core.designsystem.component.button.RoundButton import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.extension.noRippleClickable +import kotlinx.coroutines.launch @OptIn(ExperimentalMaterial3Api::class) @Composable @@ -32,6 +35,9 @@ fun SignUpBottomSheet( onDismiss: () -> Unit, onSaveClick: () -> Unit ) { + val scope = rememberCoroutineScope() + val sheetState = rememberModalBottomSheetState() + TerningBasicBottomSheet( content = { Column { @@ -51,13 +57,21 @@ fun SignUpBottomSheet( paddingVertical = 19.dp, cornerRadius = 10.dp, text = R.string.sign_up_dialog_start, - onButtonClick = { onSaveClick() }, + onButtonClick = { + scope.launch { sheetState.hide() } + .invokeOnCompletion { + if (!sheetState.isVisible) { + onSaveClick() + } + } + }, modifier = modifier.padding(horizontal = 24.dp) ) Spacer(modifier = modifier.padding(bottom = 15.dp)) } }, - onDismissRequest = { onDismiss() } + onDismissRequest = { onDismiss() }, + sheetState = sheetState ) } From e7d162bbaadc5542ae98865f733dbe6ca2831c84 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 11 Jul 2024 22:51:18 +0900 Subject: [PATCH 20/20] =?UTF-8?q?[FEAT/#14]=20startDestination=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/terning/feature/main/MainNavigator.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 3b5a56e24..859ae0c3a 100644 --- a/feature/src/main/java/com/terning/feature/main/MainNavigator.kt +++ b/feature/src/main/java/com/terning/feature/main/MainNavigator.kt @@ -13,7 +13,6 @@ 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.onboarding.signup.navigation.SignUp import com.terning.feature.search.search.navigation.navigateSearch class MainNavigator( @@ -23,7 +22,7 @@ class MainNavigator( @Composable get() = navController .currentBackStackEntryAsState().value?.destination - val startDestination = SignUp + val startDestination = SignIn val currentTab: MainTab? @Composable get() = MainTab.find { tab ->