From 4b5e9336711627575d84bb6754adc2522016fdfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=ABsungmin?= Date: Fri, 25 Oct 2024 21:48:45 +0900 Subject: [PATCH] =?UTF-8?q?[feat]=20:=20#3=20SignUpScreen=20=EC=A4=91?= =?UTF-8?q?=EB=B3=B5=20=ED=8C=8C=EC=9D=BC=20=EC=A0=9C=EA=B1=B0=20=EB=B0=8F?= =?UTF-8?q?=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopt/and/presentation/ui/SignUpScreen.kt | 175 -------------- .../presentation/ui/signup/SignUpScreen.kt | 224 ++++++++++-------- 2 files changed, 119 insertions(+), 280 deletions(-) delete mode 100644 app/src/main/java/org/sopt/and/presentation/ui/SignUpScreen.kt diff --git a/app/src/main/java/org/sopt/and/presentation/ui/SignUpScreen.kt b/app/src/main/java/org/sopt/and/presentation/ui/SignUpScreen.kt deleted file mode 100644 index f5bbaba..0000000 --- a/app/src/main/java/org/sopt/and/presentation/ui/SignUpScreen.kt +++ /dev/null @@ -1,175 +0,0 @@ -package org.sopt.and.presentation.ui - -import android.util.Log -import androidx.compose.foundation.Image -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.fillMaxSize -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.imePadding -import androidx.compose.foundation.layout.navigationBarsPadding -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.size -import androidx.compose.foundation.layout.statusBarsPadding -import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.automirrored.filled.KeyboardArrowLeft -import androidx.compose.material3.Icon -import androidx.compose.material3.IconButton -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.runtime.LaunchedEffect -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.unit.dp -import androidx.compose.ui.unit.sp -import org.sopt.and.R -import org.sopt.and.presentation.component.RoundedButton -import org.sopt.and.presentation.component.SignTextField -import org.sopt.and.presentation.component.Toolbar -import org.sopt.and.ui.theme.Black -import org.sopt.and.ui.theme.White - -@Composable -fun SignUpScreen( - navigateUp: () -> Unit, - navigateSignIn: () -> Unit, - signUpEmail: String, - signUpPwd: String, - onEmailChange: (String) -> Unit, - onPwdChange: (String) -> Unit, - isPwdVisibility: Boolean, - isPwdVisible: () -> Unit, - isSignUp: (String, String) -> Unit, - signUpSuccess: Boolean -) { - - Column( - modifier = Modifier - .fillMaxSize() - .background(Black) - .statusBarsPadding() - .navigationBarsPadding() - .imePadding(), - horizontalAlignment = Alignment.CenterHorizontally - ) { - Toolbar( - content = stringResource(R.string.signup), - leadingIcon = { - IconButton(onClick = navigateUp) { - Icon( - imageVector = Icons.AutoMirrored.Filled.KeyboardArrowLeft, - contentDescription = null, - tint = White, - modifier = Modifier - .size(40.dp) - ) - } - } - ) - - Text( - color = White, - text = stringResource(R.string.signup_title), - fontSize = 25.sp, - lineHeight = 32.sp, - modifier = Modifier - .fillMaxWidth() - .padding(start = 16.dp, end = 16.dp, top = 20.dp) - ) - - // Email 입력 - SignTextField( - value = signUpEmail, - onValueChange = onEmailChange, - isPwdVisible = true, - placeholder = stringResource(R.string.signup_id_placeholder), - modifier = Modifier.padding(10.dp) - ) - Text( - color = White, - text = stringResource(R.string.signup_id_warning), - fontSize = 14.sp, - modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 8.dp) - ) - - // Password 입력 - SignTextField( - value = signUpPwd, - onValueChange = onPwdChange, - placeholder = stringResource(R.string.signup_pwd_placeholder), - modifier = Modifier.padding(10.dp), - isPwdVisible = isPwdVisibility, - onPwdVisibilityChange = isPwdVisible - ) - Text( - color = White, - text = stringResource(R.string.signup_pwd_warning), - fontSize = 14.sp, - modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 8.dp) - ) - Spacer(modifier = Modifier.height(20.dp)) - - Text( - color = White, - text = stringResource(R.string.sign_social), - fontSize = 14.sp - ) - Row ( - modifier = Modifier - .padding(top = 20.dp), - horizontalArrangement = Arrangement.spacedBy(16.dp) - ) { - Image( - painter = painterResource(R.drawable.btn_kakao), - contentDescription = "Facebook", - modifier = Modifier - .size(32.dp) - - ) - Image( - painter = painterResource(R.drawable.btn_naver), - contentDescription = "Twitter", - modifier = Modifier - .size(32.dp) - ) - Image( - painter = painterResource(R.drawable.btn_google), - contentDescription = "Google", - modifier = Modifier - .size(32.dp) - ) - } - Spacer(modifier = Modifier.height(40.dp)) - - Text( - color = White, - text = stringResource(R.string.warning), - fontSize = 14.sp, - modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 8.dp) - ) - - Spacer(modifier = Modifier.weight(1f)) - - // 회원가입 버튼 - RoundedButton( - content = stringResource(R.string.signup), - onClick = { - isSignUp(signUpEmail, signUpPwd) - } - ) - } - - if (signUpSuccess) { - LaunchedEffect(Unit) { - navigateSignIn() // 회원가입 성공 시 navigateSignIn 호출 - Log.d("로그","LaunchedEffect navigateSignIn") - } - } - -} \ No newline at end of file diff --git a/app/src/main/java/org/sopt/and/presentation/ui/signup/SignUpScreen.kt b/app/src/main/java/org/sopt/and/presentation/ui/signup/SignUpScreen.kt index fc8c266..e222cf6 100644 --- a/app/src/main/java/org/sopt/and/presentation/ui/signup/SignUpScreen.kt +++ b/app/src/main/java/org/sopt/and/presentation/ui/signup/SignUpScreen.kt @@ -4,7 +4,6 @@ import android.util.Log import androidx.compose.foundation.Image 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.fillMaxSize @@ -15,6 +14,7 @@ import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.statusBarsPadding +import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.filled.KeyboardArrowLeft import androidx.compose.material3.Icon @@ -48,128 +48,142 @@ fun SignUpScreen( isSignUp: (String, String) -> Unit, signUpSuccess: Boolean ) { - - Column( - modifier = Modifier - .fillMaxSize() - .background(Black) - .statusBarsPadding() - .navigationBarsPadding() - .imePadding(), - horizontalAlignment = Alignment.CenterHorizontally + LazyColumn( + modifier = Modifier + .fillMaxSize() + .background(Black) + .statusBarsPadding() + .navigationBarsPadding() + .imePadding(), + horizontalAlignment = Alignment.CenterHorizontally, ) { - Toolbar( - content = stringResource(R.string.signup), - leadingIcon = { - IconButton(onClick = navigateUp) { - Icon( - imageVector = Icons.AutoMirrored.Filled.KeyboardArrowLeft, - contentDescription = null, - tint = White, - modifier = Modifier - .size(40.dp) - ) + item { + Toolbar( + content = stringResource(R.string.signup), + leadingIcon = { + IconButton(onClick = navigateUp) { + Icon( + imageVector = Icons.AutoMirrored.Filled.KeyboardArrowLeft, + contentDescription = null, + tint = White, + modifier = Modifier + .size(40.dp) + ) + } } - } - ) - - Text( - color = White, - text = stringResource(R.string.signup_title), - fontSize = 25.sp, - lineHeight = 32.sp, - modifier = Modifier - .fillMaxWidth() - .padding(start = 16.dp, end = 16.dp, top = 20.dp) - ) - - // Email 입력 - SignTextField( - value = signUpEmail, - onValueChange = onEmailChange, - isPwdVisible = true, - placeholder = stringResource(R.string.signup_id_placeholder), - modifier = Modifier.padding(10.dp) - ) - Text( - color = White, - text = stringResource(R.string.signup_id_warning), - fontSize = 14.sp, - modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 8.dp) - ) - - // Password 입력 - SignTextField( - value = signUpPwd, - onValueChange = onPwdChange, - placeholder = stringResource(R.string.signup_pwd_placeholder), - modifier = Modifier.padding(10.dp), - isPwdVisible = isPwdVisibility, - onPwdVisibilityChange = isPwdVisible - ) - Text( - color = White, - text = stringResource(R.string.signup_pwd_warning), - fontSize = 14.sp, - modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 8.dp) - ) - Spacer(modifier = Modifier.height(20.dp)) + ) + } - Text( - color = White, - text = stringResource(R.string.sign_social), - fontSize = 14.sp - ) - Row ( - modifier = Modifier - .padding(top = 20.dp), - horizontalArrangement = Arrangement.spacedBy(16.dp) - ) { - Image( - painter = painterResource(R.drawable.btn_kakao), - contentDescription = "Facebook", + item { + Text( + color = White, + text = stringResource(R.string.signup_title), + fontSize = 25.sp, + lineHeight = 32.sp, modifier = Modifier - .size(32.dp) + .fillMaxWidth() + .padding(start = 16.dp, end = 16.dp, top = 20.dp) + ) + } + item { + // Email 입력 + SignTextField( + value = signUpEmail, + onValueChange = onEmailChange, + isPwdVisible = true, + placeholder = stringResource(R.string.signup_id_placeholder), + modifier = Modifier.padding(10.dp) ) - Image( - painter = painterResource(R.drawable.btn_naver), - contentDescription = "Twitter", - modifier = Modifier - .size(32.dp) + Text( + color = White, + text = stringResource(R.string.signup_id_warning), + fontSize = 14.sp, + modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 8.dp) ) - Image( - painter = painterResource(R.drawable.btn_google), - contentDescription = "Google", - modifier = Modifier - .size(32.dp) + } + + item { + // Password 입력 + SignTextField( + value = signUpPwd, + onValueChange = onPwdChange, + placeholder = stringResource(R.string.signup_pwd_placeholder), + modifier = Modifier.padding(10.dp), + isPwdVisible = isPwdVisibility, + onPwdVisibilityChange = isPwdVisible + ) + Text( + color = White, + text = stringResource(R.string.signup_pwd_warning), + fontSize = 14.sp, + modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 8.dp) ) } - Spacer(modifier = Modifier.height(40.dp)) - Text( - color = White, - text = stringResource(R.string.warning), - fontSize = 14.sp, - modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 8.dp) - ) + item { + Spacer(modifier = Modifier.height(20.dp)) + Text( + color = White, + text = stringResource(R.string.sign_social), + fontSize = 14.sp + ) + Row( + modifier = Modifier + .padding(top = 20.dp), + horizontalArrangement = Arrangement.spacedBy(16.dp) + ) { + Image( + painter = painterResource(R.drawable.btn_kakao), + contentDescription = "kakao", + modifier = Modifier + .size(32.dp) - Spacer(modifier = Modifier.weight(1f)) + ) + Image( + painter = painterResource(R.drawable.btn_naver), + contentDescription = "naver", + modifier = Modifier + .size(32.dp) + ) + Image( + painter = painterResource(R.drawable.btn_google), + contentDescription = "Google", + modifier = Modifier + .size(32.dp) + ) + } + } + + item { + Spacer(modifier = Modifier.height(40.dp)) + Text( + color = White, + text = stringResource(R.string.warning), + fontSize = 14.sp, + modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 8.dp) + ) + } // 회원가입 버튼 - RoundedButton( - content = stringResource(R.string.signup), - onClick = { - isSignUp(signUpEmail, signUpPwd) - } - ) + item { + Spacer(modifier = Modifier.height(16.dp)) + RoundedButton( + content = stringResource(R.string.signup), + onClick = { + isSignUp(signUpEmail, signUpPwd) + }, + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 16.dp) + ) + } } if (signUpSuccess) { LaunchedEffect(Unit) { navigateSignIn() // 회원가입 성공 시 navigateSignIn 호출 - Log.d("로그","LaunchedEffect navigateSignIn") + Log.d("로그", "LaunchedEffect navigateSignIn") } } - } \ No newline at end of file