-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…uth-ui [Feature/#13] : 스플래시&로그인&회원가입2 페이지 구현
- Loading branch information
Showing
42 changed files
with
770 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 20 additions & 2 deletions
22
app/src/main/java/com/hackathon/alddeul_babsang/core_ui/component/AlddeulButton.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,49 @@ | ||
package com.hackathon.alddeul_babsang.core_ui.component | ||
|
||
import androidx.compose.foundation.BorderStroke | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material3.Button | ||
import androidx.compose.material3.ButtonDefaults | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.unit.dp | ||
import com.hackathon.alddeul_babsang.core_ui.theme.Orange900 | ||
import com.hackathon.alddeul_babsang.core_ui.theme.White | ||
import com.hackathon.alddeul_babsang.core_ui.theme.title4Bold | ||
|
||
@Composable | ||
fun AlddeulButton( | ||
text: Int, | ||
textColor: Color = White, | ||
color: Color = Orange900, | ||
stroke: Color = Orange900, | ||
onClick: () -> Unit | ||
) { | ||
Button( | ||
modifier = Modifier | ||
.fillMaxWidth(), | ||
.fillMaxWidth() | ||
.clip(RoundedCornerShape(40.dp)), | ||
border = BorderStroke( | ||
width = 1.dp, | ||
color = stroke | ||
), | ||
colors = ButtonDefaults.buttonColors( | ||
containerColor = color | ||
), | ||
contentPadding = PaddingValues(vertical = 19.dp), | ||
onClick = { onClick() } | ||
) { | ||
Text( | ||
text = stringResource(id = text), | ||
style = title4Bold, | ||
color = White | ||
color = textColor | ||
) | ||
} | ||
} |
42 changes: 33 additions & 9 deletions
42
app/src/main/java/com/hackathon/alddeul_babsang/core_ui/component/AuthTextField.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,60 @@ | ||
package com.hackathon.alddeul_babsang.core_ui.component | ||
|
||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.TextField | ||
import androidx.compose.material3.TextFieldDefaults | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import com.hackathon.alddeul_babsang.core_ui.theme.Gray300 | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import com.hackathon.alddeul_babsang.core_ui.theme.Gray200 | ||
import com.hackathon.alddeul_babsang.core_ui.theme.Orange900 | ||
import com.hackathon.alddeul_babsang.core_ui.theme.head4Bold | ||
import com.hackathon.alddeul_babsang.core_ui.theme.Regular | ||
import com.hackathon.alddeul_babsang.core_ui.theme.body1Regular | ||
|
||
@Composable | ||
fun AuthTextField( | ||
modifier: Modifier = Modifier, | ||
value: String, | ||
onValueChange: (String) -> Unit, | ||
placeholderText: String | ||
placeholderText: String, | ||
textAlign: TextAlign = TextAlign.Start | ||
) { | ||
TextField( | ||
modifier = modifier | ||
.fillMaxWidth() | ||
.padding(horizontal = 18.dp), | ||
value = value, | ||
onValueChange = onValueChange, | ||
placeholder = { | ||
Text( | ||
modifier = Modifier.fillMaxWidth(), | ||
text = placeholderText, | ||
style = head4Bold, | ||
color = Gray300, | ||
style = body1Regular, | ||
color = Gray200, | ||
textAlign = textAlign | ||
) | ||
}, | ||
textStyle = body1Regular.copy(textAlign = textAlign), | ||
colors = TextFieldDefaults.colors( | ||
focusedContainerColor = Color.White, // 포커스된 상태에서 배경색을 흰색으로 설정 | ||
unfocusedContainerColor = Color.White, // 비포커스 상태에서 배경색을 흰색으로 설정 | ||
cursorColor = Color.Black, | ||
focusedContainerColor = Color.Transparent, | ||
unfocusedContainerColor = Color.Transparent, | ||
focusedIndicatorColor = Orange900, | ||
unfocusedIndicatorColor = Gray300 | ||
unfocusedIndicatorColor = Regular | ||
) | ||
) | ||
} | ||
|
||
@Preview(showBackground = true) | ||
@Composable | ||
fun AuthTextFieldPreview() { | ||
AuthTextField( | ||
value = "", | ||
onValueChange = {}, | ||
placeholderText = "아이디", | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
31 changes: 31 additions & 0 deletions
31
app/src/main/java/com/hackathon/alddeul_babsang/presentation/auth/navigation/AuthNavGraph.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.hackathon.alddeul_babsang.presentation.auth.navigation | ||
|
||
import androidx.navigation.NavGraphBuilder | ||
import androidx.navigation.compose.composable | ||
import com.hackathon.alddeul_babsang.presentation.auth.screen.LoginRoute | ||
import com.hackathon.alddeul_babsang.presentation.auth.screen.SignUp1Route | ||
import com.hackathon.alddeul_babsang.presentation.auth.screen.SignUp2Route | ||
|
||
fun NavGraphBuilder.loginNavGraph( | ||
navigator: AuthNavigator | ||
) { | ||
composable(route = "login") { | ||
LoginRoute(navigator) | ||
} | ||
} | ||
|
||
fun NavGraphBuilder.signUp1NavGraph( | ||
navigator: AuthNavigator | ||
) { | ||
composable(route = "signUp1") { | ||
SignUp1Route(navigator) | ||
} | ||
} | ||
|
||
fun NavGraphBuilder.signUp2NavGraph( | ||
navigator: AuthNavigator | ||
) { | ||
composable(route = "signUp2") { | ||
SignUp2Route(navigator) | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...src/main/java/com/hackathon/alddeul_babsang/presentation/auth/navigation/AuthNavigator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.hackathon.alddeul_babsang.presentation.auth.navigation | ||
|
||
import androidx.navigation.NavHostController | ||
|
||
class AuthNavigator( | ||
val navController: NavHostController | ||
) { | ||
fun navigateLogin() { | ||
navController.navigate(route = "login") | ||
} | ||
|
||
fun navigateBack() { | ||
navController.popBackStack() | ||
} | ||
|
||
fun navigateMain() { | ||
navController.navigate(route = "main") { | ||
popUpTo(0) { | ||
inclusive = true | ||
} | ||
} | ||
} | ||
|
||
fun navigateSignUp1() { | ||
navController.navigate(route = "signup1") | ||
} | ||
|
||
fun navigateSignUp2() { | ||
navController.navigate(route = "signup2") | ||
} | ||
} |
141 changes: 141 additions & 0 deletions
141
app/src/main/java/com/hackathon/alddeul_babsang/presentation/auth/screen/LoginScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
package com.hackathon.alddeul_babsang.presentation.auth.screen | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Column | ||
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.padding | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.SideEffect | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.setValue | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Brush | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.platform.LocalSoftwareKeyboardController | ||
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.google.accompanist.systemuicontroller.rememberSystemUiController | ||
import com.hackathon.alddeul_babsang.R | ||
import com.hackathon.alddeul_babsang.core_ui.component.AlddeulButton | ||
import com.hackathon.alddeul_babsang.core_ui.component.AuthTextField | ||
import com.hackathon.alddeul_babsang.core_ui.theme.AlddeulBabsangTheme | ||
import com.hackathon.alddeul_babsang.core_ui.theme.Gray100 | ||
import com.hackathon.alddeul_babsang.core_ui.theme.Gray200 | ||
import com.hackathon.alddeul_babsang.core_ui.theme.Orange900 | ||
import com.hackathon.alddeul_babsang.core_ui.theme.Peach100 | ||
import com.hackathon.alddeul_babsang.core_ui.theme.Peach50 | ||
import com.hackathon.alddeul_babsang.core_ui.theme.White | ||
import com.hackathon.alddeul_babsang.core_ui.theme.bmDohyeonRegular | ||
import com.hackathon.alddeul_babsang.presentation.auth.navigation.AuthNavigator | ||
import com.hackathon.alddeul_babsang.util.toast | ||
import kotlin.contracts.contract | ||
|
||
@Composable | ||
fun LoginRoute( | ||
navigator: AuthNavigator | ||
) { | ||
val systemUiController = rememberSystemUiController() | ||
val keyboardController = LocalSoftwareKeyboardController.current | ||
|
||
SideEffect { | ||
systemUiController.setStatusBarColor( | ||
color = Peach100 | ||
) | ||
} | ||
|
||
LoginScreen( | ||
onLoginClick = { | ||
keyboardController?.hide() | ||
navigator.navigateMain() | ||
}, | ||
onSignUpClick = { navigator.navigateSignUp1() } | ||
) | ||
} | ||
|
||
@Composable | ||
fun LoginScreen( | ||
onLoginClick: () -> Unit = {}, | ||
onSignUpClick: () -> Unit = {} | ||
) { | ||
val verticalGradient = Brush.verticalGradient( | ||
colors = listOf(Peach50, White), | ||
startY = 0.0f, | ||
endY = 9000f, | ||
) | ||
var id by remember { mutableStateOf("") } | ||
var password by remember { mutableStateOf("") } | ||
val context = LocalContext.current | ||
|
||
Column( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.background(verticalGradient) | ||
) { | ||
Image( | ||
modifier = Modifier.fillMaxWidth(), | ||
painter = painterResource(id = R.drawable.ic_login_logo), | ||
contentDescription = null | ||
) | ||
Text( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(top = 10.dp), | ||
text = stringResource(R.string.tv_login_title), | ||
style = bmDohyeonRegular, | ||
color = Orange900, | ||
textAlign = TextAlign.Center | ||
) | ||
Column( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.padding(16.dp) | ||
) { | ||
AuthTextField( | ||
value = id, | ||
onValueChange = { id = it }, | ||
placeholderText = stringResource(R.string.tv_login_id_placeholder) | ||
) | ||
Spacer(modifier = Modifier.height(16.dp)) | ||
AuthTextField( | ||
value = password, | ||
onValueChange = { password = it }, | ||
placeholderText = stringResource(R.string.tv_login_password_placeholder) | ||
) | ||
Spacer(modifier = Modifier.weight(1f)) | ||
AlddeulButton(text = R.string.btn_login) { | ||
if (id.isNotBlank() && password.isNotBlank()) { | ||
onLoginClick() | ||
} else { | ||
context.toast(context.getString(R.string.toast_login_failure)) | ||
} | ||
} | ||
Spacer(modifier = Modifier.height(10.dp)) | ||
AlddeulButton( | ||
text = R.string.btn_login_signup, | ||
textColor = Gray200, | ||
color = White, | ||
stroke = Gray100 | ||
) { | ||
onSignUpClick() | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Preview(showBackground = true) | ||
@Composable | ||
fun LoginScreenPreview() { | ||
AlddeulBabsangTheme { | ||
LoginScreen() | ||
} | ||
} |
Oops, something went wrong.