Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UI/YAF-66] 온보딩 생년월일 UI를 구현합니다. #22

Merged
merged 7 commits into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
package com.kms.onboarding

import androidx.compose.foundation.layout.Box
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.padding
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
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 androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.navigation.compose.NavHost
Expand All @@ -25,9 +17,6 @@ import com.kms.onboarding.component.OnboardingBottomBar
import com.kms.onboarding.navigation.onboardingNavGraph
import com.kms.onboarding.navigation.rememberOnboardingAppState
import com.yapp.designsystem.theme.OrbitTheme
import com.yapp.ui.component.timepicker.OrbitPicker
import com.yapp.ui.utils.heightForScreenPercentage
import feature.onboarding.R

@Composable
fun OnboardingRoute(
Expand Down Expand Up @@ -105,114 +94,3 @@ fun OnboardingScreen(
}
}
}

@Composable
fun ExplainScreen(
state: OnboardingContract.State,
onNextClick: () -> Unit,
) {
OnboardingScreen(
currentStep = 0,
totalSteps = 0,
isButtonEnabled = true,
onNextClick = onNextClick,
onBackClick = null,
showTopAppBar = false,
) {
Column(modifier = Modifier.fillMaxSize()) {
Spacer(modifier = Modifier.heightForScreenPercentage(0.105f))
Text(
text = stringResource(id = R.string.onboarding_step1_text_title),
style = OrbitTheme.typography.body1Regular,
color = OrbitTheme.colors.gray_100,
modifier = Modifier
.padding(horizontal = 20.dp)
.fillMaxWidth(),
textAlign = TextAlign.Center,
)
Text(
text = stringResource(id = R.string.onboarding_step1_text_subtitle),
style = OrbitTheme.typography.heading1SemiBold,
color = OrbitTheme.colors.white,
modifier = Modifier
.padding(horizontal = 20.dp)
.padding(top = 12.dp)
.fillMaxWidth(),
textAlign = TextAlign.Center,
)
}
}
}

@Composable
fun AlarmTimeSelectionScreen(
state: OnboardingContract.State,
currentStep: Int,
totalSteps: Int,
onNextClick: () -> Unit,
onBackClick: () -> Unit,
) {
OnboardingScreen(
currentStep = currentStep,
totalSteps = totalSteps,
isButtonEnabled = true,
onNextClick = onNextClick,
onBackClick = onBackClick,
) {
Column(modifier = Modifier.fillMaxSize()) {
Spacer(modifier = Modifier.heightForScreenPercentage(0.05f))
Text(
text = stringResource(id = R.string.onboarding_step2_text_title),
style = OrbitTheme.typography.heading1SemiBold,
color = OrbitTheme.colors.white,
modifier = Modifier.fillMaxWidth(),
textAlign = TextAlign.Center,
)
Text(
text = stringResource(id = R.string.onboarding_step2_text_subtitle),
style = OrbitTheme.typography.body1Regular,
color = OrbitTheme.colors.gray_100,
modifier = Modifier
.padding(top = 4.dp)
.fillMaxWidth(),
textAlign = TextAlign.Center,
)
OrbitPicker(
modifier = Modifier.padding(top = 90.dp),
)
}
}
}

@Composable
fun BirthdayScreen(
state: OnboardingContract.State,
currentStep: Int,
totalSteps: Int,
onNextClick: () -> Unit,
onBackClick: () -> Unit,
) {
OnboardingScreen(
currentStep = currentStep,
totalSteps = totalSteps,
isButtonEnabled = true,
onNextClick = onNextClick,
onBackClick = onBackClick,
) {
Column { }
}
}

@Composable
@Preview
fun OnboardingPreview() {
OrbitTheme {
AlarmTimeSelectionScreen(
state = OnboardingContract.State(),
currentStep = 1,
totalSteps = 2,
onNextClick = {},
onBackClick = {},
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.kms.onboarding

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.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.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.yapp.designsystem.theme.OrbitTheme
import com.yapp.ui.component.timepicker.OrbitPicker
import com.yapp.ui.utils.heightForScreenPercentage
import feature.onboarding.R

@Composable
fun OnboardingAlarmTimeSelectionScreen(
state: OnboardingContract.State,
currentStep: Int,
totalSteps: Int,
onNextClick: () -> Unit,
onBackClick: () -> Unit,
) {
OnboardingScreen(
currentStep = currentStep,
totalSteps = totalSteps,
isButtonEnabled = true,
onNextClick = onNextClick,
onBackClick = onBackClick,
) {
Column(modifier = Modifier.fillMaxSize()) {
Spacer(modifier = Modifier.heightForScreenPercentage(0.05f))
Text(
text = stringResource(id = R.string.onboarding_step2_text_title),
style = OrbitTheme.typography.heading1SemiBold,
color = OrbitTheme.colors.white,
modifier = Modifier.fillMaxWidth(),
textAlign = TextAlign.Center,
)
Text(
text = stringResource(id = R.string.onboarding_step2_text_subtitle),
style = OrbitTheme.typography.body1Regular,
color = OrbitTheme.colors.gray_100,
modifier = Modifier
.padding(top = 4.dp)
.fillMaxWidth(),
textAlign = TextAlign.Center,
)
OrbitPicker(
modifier = Modifier.padding(top = 90.dp),
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.kms.onboarding

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.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.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.yapp.designsystem.theme.OrbitTheme
import com.yapp.ui.component.timepicker.OrbitYearMonthPicker
import com.yapp.ui.utils.heightForScreenPercentage
import feature.onboarding.R

@Composable
fun OnboardingBirthdayScreen(
state: OnboardingContract.State,
currentStep: Int,
totalSteps: Int,
onNextClick: () -> Unit,
onBackClick: () -> Unit,
) {
OnboardingScreen(
currentStep = currentStep,
totalSteps = totalSteps,
isButtonEnabled = true,
onNextClick = onNextClick,
onBackClick = onBackClick,
) {
Column(modifier = Modifier.fillMaxSize()) {
Spacer(modifier = Modifier.heightForScreenPercentage(0.05f))
Text(
text = stringResource(id = R.string.onboarding_step3_text_title),
style = OrbitTheme.typography.heading1SemiBold,
color = OrbitTheme.colors.white,
modifier = Modifier.fillMaxWidth(),
textAlign = TextAlign.Center,
)
OrbitYearMonthPicker(
modifier = Modifier.padding(top = 60.dp),
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.kms.onboarding

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.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.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.yapp.designsystem.theme.OrbitTheme
import com.yapp.ui.utils.heightForScreenPercentage
import feature.onboarding.R

@Composable
fun OnboardingExplainScreen(
state: OnboardingContract.State,
onNextClick: () -> Unit,
) {
OnboardingScreen(
currentStep = 0,
totalSteps = 0,
isButtonEnabled = true,
onNextClick = onNextClick,
onBackClick = null,
showTopAppBar = false,
) {
Column(modifier = Modifier.fillMaxSize()) {
Spacer(modifier = Modifier.heightForScreenPercentage(0.105f))
Text(
text = stringResource(id = R.string.onboarding_step1_text_title),
style = OrbitTheme.typography.body1Regular,
color = OrbitTheme.colors.gray_100,
modifier = Modifier
.padding(horizontal = 20.dp)
.fillMaxWidth(),
textAlign = TextAlign.Center,
)
Text(
text = stringResource(id = R.string.onboarding_step1_text_subtitle),
style = OrbitTheme.typography.heading1SemiBold,
color = OrbitTheme.colors.white,
modifier = Modifier
.padding(horizontal = 20.dp)
.padding(top = 12.dp)
.fillMaxWidth(),
textAlign = TextAlign.Center,
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ package com.kms.onboarding.navigation

import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.kms.onboarding.AlarmTimeSelectionScreen
import com.kms.onboarding.BirthdayScreen
import com.kms.onboarding.ExplainScreen
import com.kms.onboarding.OnboardingAlarmTimeSelectionScreen
import com.kms.onboarding.OnboardingBirthdayScreen
import com.kms.onboarding.OnboardingContract
import com.kms.onboarding.OnboardingExplainScreen

fun NavGraphBuilder.onboardingNavGraph(
stateProvider: () -> OnboardingContract.State,
eventDispatcher: (OnboardingContract.Action) -> Unit,
onFinishOnboarding: () -> Unit,
) {
composable(OnboardingDestination.Explain.route) {
ExplainScreen(
OnboardingExplainScreen(
state = stateProvider(),
onNextClick = {
eventDispatcher(OnboardingContract.Action.NextStep)
Expand All @@ -22,7 +22,7 @@ fun NavGraphBuilder.onboardingNavGraph(
}

composable(OnboardingDestination.AlarmTimeSelection.route) {
AlarmTimeSelectionScreen(
OnboardingAlarmTimeSelectionScreen(
state = stateProvider(),
currentStep = 1,
totalSteps = 2,
Expand All @@ -36,7 +36,7 @@ fun NavGraphBuilder.onboardingNavGraph(
}

composable(OnboardingDestination.Birthday.route) {
BirthdayScreen(
OnboardingBirthdayScreen(
state = stateProvider(),
currentStep = 2,
totalSteps = 2,
Expand Down
Loading