Skip to content

Commit

Permalink
[feature/login_term] 약관동의 페이지 이동 (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
SsongSik committed Aug 28, 2023
1 parent 7c7051a commit 4119f2f
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavHostController
import androidx.navigation.NavController
import androidx.navigation.compose.rememberNavController
import com.meongmoryteam.presentation.R
import com.meongmoryteam.presentation.base.TextButtonComponent
Expand All @@ -38,9 +38,11 @@ import com.meongmoryteam.presentation.ui.theme.LightGrey
import com.meongmoryteam.presentation.ui.theme.NotoSansKR
import com.meongmoryteam.presentation.ui.theme.Orange
import com.meongmoryteam.presentation.ui.theme.Typography
import kotlinx.coroutines.flow.collectLatest

@Composable
fun CertificationScreen(
navController: NavController,
loginViewModel: LoginViewModel = hiltViewModel(),
navigateToTermScreen: () -> Unit,
) {
Expand Down Expand Up @@ -80,10 +82,10 @@ fun CertificationScreen(
}

LaunchedEffect(key1 = loginViewModel.effect) {
loginViewModel.effect.collect { effect ->
loginViewModel.effect.collectLatest { effect ->
when (effect) {
is LoginContract.LoginEffect.MoveToTerm -> {
navigateToTermScreen()
navController.navigate(LoginNaviRoute.TermScreen.route)
}
is LoginContract.LoginEffect.FailCertification -> {
/*
Expand Down Expand Up @@ -216,7 +218,9 @@ fun LoginPhoneTextField(
@Preview
@Composable
fun LoginScreenPreview() {
CertificationScreen() {
CertificationScreen(
navController = rememberNavController(),
) {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,15 @@ fun LoginNavigation(
) {
composable(route = LoginNaviRoute.CertificationScreen.route) {
CertificationScreen(
navController = navController,
navigateToTermScreen = { navController.navigate(LoginNaviRoute.TermScreen.route) }
)
}
composable(route = LoginNaviRoute.TermScreen.route) {
TermScreen(
navigateToPreviousScreen = { },
navigateToNicknameScreen = { }
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.meongmoryteam.presentation.ui.login

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.meongmoryteam.presentation.R

@Composable
fun TermScreen(
navigateToPreviousScreen: () -> Unit,
navigateToNicknameScreen: () -> Unit
) {
Column(
modifier = Modifier
.fillMaxSize()
.background(Color.White)
) {
TermTitle()
TermContent()
}
}

@Composable
fun TermTitle() {
Icon(
modifier = Modifier.padding(12.dp),
painter = painterResource(R.drawable.ic_left_btn),
contentDescription = stringResource(R.string.term_back_button),
)
Text(
modifier = Modifier
.fillMaxWidth(),
textAlign = TextAlign.Center,
text = stringResource(R.string.term_title),
)
}

@Preview
@Composable
fun TermContent() {
TermScreen(
navigateToPreviousScreen = {},
navigateToNicknameScreen = {}
)
}
3 changes: 3 additions & 0 deletions presentation/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@
<string name="login_phone_post_certification_button">인증 요청</string>
<string name="login_phone_login_next_button">다음</string>

<string name="term_back_button">약관동의 닫기 버튼</string>
<string name="term_title">약관동의</string>

<!-- 에러 메세지 -->
<string name="network_error_message">네트워크 에러가 발생하였습니다.</string>
</resources>

0 comments on commit 4119f2f

Please sign in to comment.