|
| 1 | +package com.yapp.ndgl.core.ui.designsystem |
| 2 | + |
| 3 | +import androidx.compose.foundation.clickable |
| 4 | +import androidx.compose.foundation.layout.Arrangement |
| 5 | +import androidx.compose.foundation.layout.Column |
| 6 | +import androidx.compose.foundation.layout.fillMaxWidth |
| 7 | +import androidx.compose.foundation.layout.padding |
| 8 | +import androidx.compose.foundation.layout.wrapContentHeight |
| 9 | +import androidx.compose.foundation.shape.RoundedCornerShape |
| 10 | +import androidx.compose.material3.Surface |
| 11 | +import androidx.compose.material3.Text |
| 12 | +import androidx.compose.runtime.Composable |
| 13 | +import androidx.compose.ui.Alignment |
| 14 | +import androidx.compose.ui.Modifier |
| 15 | +import androidx.compose.ui.res.stringResource |
| 16 | +import androidx.compose.ui.text.style.TextAlign |
| 17 | +import androidx.compose.ui.text.style.TextDecoration |
| 18 | +import androidx.compose.ui.tooling.preview.Preview |
| 19 | +import androidx.compose.ui.unit.dp |
| 20 | +import androidx.compose.ui.window.Dialog |
| 21 | +import androidx.compose.ui.window.DialogProperties |
| 22 | +import com.yapp.ndgl.core.ui.R |
| 23 | +import com.yapp.ndgl.core.ui.theme.NDGLTheme |
| 24 | + |
| 25 | +@Composable |
| 26 | +fun UserGuideModal( |
| 27 | + onConfirmClick: () -> Unit, |
| 28 | + onTermsClick: () -> Unit, |
| 29 | + modifier: Modifier = Modifier, |
| 30 | +) { |
| 31 | + Dialog( |
| 32 | + onDismissRequest = { /* 확인 버튼을 눌러야만 닫힘 */ }, |
| 33 | + properties = DialogProperties( |
| 34 | + dismissOnBackPress = false, |
| 35 | + dismissOnClickOutside = false, |
| 36 | + ), |
| 37 | + ) { |
| 38 | + Surface( |
| 39 | + modifier = modifier.wrapContentHeight(), |
| 40 | + shape = RoundedCornerShape(8.dp), |
| 41 | + color = NDGLTheme.colors.white, |
| 42 | + shadowElevation = 16.dp, |
| 43 | + ) { |
| 44 | + Column( |
| 45 | + modifier = Modifier |
| 46 | + .padding(horizontal = 28.dp) |
| 47 | + .padding(top = 28.dp, bottom = 24.dp), |
| 48 | + verticalArrangement = Arrangement.spacedBy(28.dp), |
| 49 | + horizontalAlignment = Alignment.CenterHorizontally, |
| 50 | + ) { |
| 51 | + UserGuideContent( |
| 52 | + onTermsClick = onTermsClick, |
| 53 | + ) |
| 54 | + NDGLCTAButton( |
| 55 | + type = NDGLCTAButtonAttr.Type.PRIMARY, |
| 56 | + size = NDGLCTAButtonAttr.Size.MEDIUM, |
| 57 | + status = NDGLCTAButtonAttr.Status.ACTIVE, |
| 58 | + label = stringResource(R.string.user_guide_modal_confirm), |
| 59 | + onClick = onConfirmClick, |
| 60 | + modifier = Modifier.fillMaxWidth(), |
| 61 | + ) |
| 62 | + } |
| 63 | + } |
| 64 | + } |
| 65 | +} |
| 66 | + |
| 67 | +@Composable |
| 68 | +private fun UserGuideContent( |
| 69 | + onTermsClick: () -> Unit, |
| 70 | +) { |
| 71 | + Column( |
| 72 | + horizontalAlignment = Alignment.CenterHorizontally, |
| 73 | + ) { |
| 74 | + Text( |
| 75 | + text = stringResource(R.string.user_guide_modal_title), |
| 76 | + modifier = Modifier.fillMaxWidth(), |
| 77 | + color = NDGLTheme.colors.black900, |
| 78 | + textAlign = TextAlign.Center, |
| 79 | + style = NDGLTheme.typography.subtitleLgSemiBold, |
| 80 | + ) |
| 81 | + Text( |
| 82 | + text = stringResource(R.string.user_guide_modal_body), |
| 83 | + modifier = Modifier |
| 84 | + .fillMaxWidth() |
| 85 | + .padding(top = 16.dp), |
| 86 | + color = NDGLTheme.colors.black500, |
| 87 | + textAlign = TextAlign.Center, |
| 88 | + style = NDGLTheme.typography.bodyLgMedium, |
| 89 | + ) |
| 90 | + Text( |
| 91 | + text = stringResource(R.string.user_guide_modal_terms), |
| 92 | + modifier = Modifier |
| 93 | + .padding(top = 12.dp) |
| 94 | + .clickable(onClick = onTermsClick), |
| 95 | + color = NDGLTheme.colors.black400, |
| 96 | + textAlign = TextAlign.Center, |
| 97 | + textDecoration = TextDecoration.Underline, |
| 98 | + style = NDGLTheme.typography.bodyMdMedium, |
| 99 | + ) |
| 100 | + } |
| 101 | +} |
| 102 | + |
| 103 | +@Preview(showBackground = true) |
| 104 | +@Composable |
| 105 | +private fun UserGuideModalPreview() { |
| 106 | + NDGLTheme { |
| 107 | + UserGuideModal( |
| 108 | + onConfirmClick = {}, |
| 109 | + onTermsClick = {}, |
| 110 | + ) |
| 111 | + } |
| 112 | +} |
0 commit comments