|
| 1 | +package com.threegap.bitnagil.presentation.splash.component.template |
| 2 | + |
| 3 | +import androidx.compose.foundation.background |
| 4 | +import androidx.compose.foundation.layout.Arrangement |
| 5 | +import androidx.compose.foundation.layout.Column |
| 6 | +import androidx.compose.foundation.layout.Row |
| 7 | +import androidx.compose.foundation.layout.Spacer |
| 8 | +import androidx.compose.foundation.layout.fillMaxWidth |
| 9 | +import androidx.compose.foundation.layout.height |
| 10 | +import androidx.compose.foundation.layout.padding |
| 11 | +import androidx.compose.foundation.shape.RoundedCornerShape |
| 12 | +import androidx.compose.material3.BasicAlertDialog |
| 13 | +import androidx.compose.material3.ExperimentalMaterial3Api |
| 14 | +import androidx.compose.material3.Text |
| 15 | +import androidx.compose.runtime.Composable |
| 16 | +import androidx.compose.ui.Modifier |
| 17 | +import androidx.compose.ui.text.style.LineHeightStyle |
| 18 | +import androidx.compose.ui.tooling.preview.Preview |
| 19 | +import androidx.compose.ui.unit.dp |
| 20 | +import androidx.compose.ui.window.DialogProperties |
| 21 | +import com.threegap.bitnagil.designsystem.BitnagilTheme |
| 22 | +import com.threegap.bitnagil.designsystem.component.atom.BitnagilTextButton |
| 23 | +import com.threegap.bitnagil.designsystem.component.atom.BitnagilTextButtonColor |
| 24 | + |
| 25 | +@OptIn(ExperimentalMaterial3Api::class) |
| 26 | +@Composable |
| 27 | +fun ForceUpdateDialog( |
| 28 | + onUpdateClick: () -> Unit, |
| 29 | + onDismissRequest: () -> Unit, |
| 30 | + modifier: Modifier = Modifier, |
| 31 | +) { |
| 32 | + BasicAlertDialog( |
| 33 | + onDismissRequest = onDismissRequest, |
| 34 | + properties = DialogProperties( |
| 35 | + dismissOnBackPress = false, |
| 36 | + dismissOnClickOutside = false, |
| 37 | + ), |
| 38 | + modifier = modifier |
| 39 | + .background( |
| 40 | + color = BitnagilTheme.colors.white, |
| 41 | + shape = RoundedCornerShape(12.dp), |
| 42 | + ) |
| 43 | + .padding(vertical = 20.dp, horizontal = 24.dp), |
| 44 | + ) { |
| 45 | + Column( |
| 46 | + modifier = Modifier, |
| 47 | + ) { |
| 48 | + Text( |
| 49 | + text = "최신 버전으로 업데이트가 필요해요", |
| 50 | + color = BitnagilTheme.colors.coolGray10, |
| 51 | + style = BitnagilTheme.typography.subtitle1SemiBold.copy( |
| 52 | + lineHeightStyle = LineHeightStyle( |
| 53 | + alignment = LineHeightStyle.Alignment.Center, |
| 54 | + trim = LineHeightStyle.Trim.None, |
| 55 | + ), |
| 56 | + ), |
| 57 | + ) |
| 58 | + |
| 59 | + Text( |
| 60 | + text = "더 안정적이고 안전한 서비스를 위해\n최신 버전으로 업데이트해 주세요.", |
| 61 | + color = BitnagilTheme.colors.coolGray40, |
| 62 | + style = BitnagilTheme.typography.body2Medium.copy( |
| 63 | + lineHeightStyle = LineHeightStyle( |
| 64 | + alignment = LineHeightStyle.Alignment.Center, |
| 65 | + trim = LineHeightStyle.Trim.None, |
| 66 | + ), |
| 67 | + ), |
| 68 | + ) |
| 69 | + |
| 70 | + Spacer(modifier = Modifier.height(18.dp)) |
| 71 | + |
| 72 | + Row( |
| 73 | + modifier = Modifier.fillMaxWidth(), |
| 74 | + horizontalArrangement = Arrangement.spacedBy(12.dp), |
| 75 | + ) { |
| 76 | + BitnagilTextButton( |
| 77 | + text = "나가기", |
| 78 | + onClick = onDismissRequest, |
| 79 | + colors = BitnagilTextButtonColor.cancel(), |
| 80 | + textStyle = BitnagilTheme.typography.body2Medium, |
| 81 | + modifier = Modifier.weight(1f), |
| 82 | + ) |
| 83 | + |
| 84 | + BitnagilTextButton( |
| 85 | + text = "업데이트", |
| 86 | + onClick = onUpdateClick, |
| 87 | + textStyle = BitnagilTheme.typography.body2Medium, |
| 88 | + modifier = Modifier.weight(1f), |
| 89 | + ) |
| 90 | + } |
| 91 | + } |
| 92 | + } |
| 93 | +} |
| 94 | + |
| 95 | +@Preview |
| 96 | +@Composable |
| 97 | +private fun ForceUpdateDialogPreview() { |
| 98 | + ForceUpdateDialog( |
| 99 | + onUpdateClick = {}, |
| 100 | + onDismissRequest = {}, |
| 101 | + ) |
| 102 | +} |
0 commit comments