|
| 1 | +package com.terning.feature.splash.component |
| 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.height |
| 9 | +import androidx.compose.foundation.layout.padding |
| 10 | +import androidx.compose.foundation.shape.RoundedCornerShape |
| 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.draw.clip |
| 16 | +import androidx.compose.ui.res.stringResource |
| 17 | +import androidx.compose.ui.text.style.TextAlign |
| 18 | +import androidx.compose.ui.text.style.TextOverflow |
| 19 | +import androidx.compose.ui.tooling.preview.Preview |
| 20 | +import androidx.compose.ui.unit.dp |
| 21 | +import androidx.compose.ui.window.Dialog |
| 22 | +import androidx.compose.ui.window.DialogProperties |
| 23 | +import com.terning.core.designsystem.component.dialog.NoticeDialogButton |
| 24 | +import com.terning.core.designsystem.theme.Back |
| 25 | +import com.terning.core.designsystem.theme.Black |
| 26 | +import com.terning.core.designsystem.theme.Grey150 |
| 27 | +import com.terning.core.designsystem.theme.Grey200 |
| 28 | +import com.terning.core.designsystem.theme.Grey350 |
| 29 | +import com.terning.core.designsystem.theme.Grey400 |
| 30 | +import com.terning.core.designsystem.theme.Grey500 |
| 31 | +import com.terning.core.designsystem.theme.TerningMain |
| 32 | +import com.terning.core.designsystem.theme.TerningMain2 |
| 33 | +import com.terning.core.designsystem.theme.TerningPointTheme |
| 34 | +import com.terning.core.designsystem.theme.TerningTheme |
| 35 | +import com.terning.core.designsystem.theme.White |
| 36 | +import com.terning.feature.splash.R |
| 37 | + |
| 38 | +@Composable |
| 39 | +internal fun TerningServerNoticeDialog( |
| 40 | + onDismissButtonClick: () -> Unit, |
| 41 | + onDetailButtonClick: () -> Unit, |
| 42 | +) { |
| 43 | + Dialog( |
| 44 | + onDismissRequest = { }, |
| 45 | + properties = DialogProperties( |
| 46 | + dismissOnBackPress = false, |
| 47 | + dismissOnClickOutside = false, |
| 48 | + usePlatformDefaultWidth = false, |
| 49 | + ) |
| 50 | + ) { |
| 51 | + Column( |
| 52 | + horizontalAlignment = Alignment.CenterHorizontally, |
| 53 | + modifier = Modifier |
| 54 | + .padding(horizontal = 28.dp) |
| 55 | + .background(color = White, shape = RoundedCornerShape(20.dp)) |
| 56 | + .padding(12.dp) |
| 57 | + ) { |
| 58 | + Text( |
| 59 | + text = stringResource(R.string.dialog_server_title), |
| 60 | + style = TerningTheme.typography.title2, |
| 61 | + color = Grey500, |
| 62 | + modifier = Modifier.padding(top = 20.dp) |
| 63 | + ) |
| 64 | + Spacer(modifier = Modifier.height(20.dp)) |
| 65 | + Text( |
| 66 | + text = stringResource(R.string.dialog_bodytitle), |
| 67 | + style = TerningTheme.typography.body4.copy(textAlign = TextAlign.Center), |
| 68 | + overflow = TextOverflow.Clip, |
| 69 | + color = Grey400, |
| 70 | + ) |
| 71 | + Spacer(modifier = Modifier.height(26.dp)) |
| 72 | + Column( |
| 73 | + modifier = Modifier |
| 74 | + .clip(RoundedCornerShape(5.dp)) |
| 75 | + .background(Back) |
| 76 | + .padding( |
| 77 | + vertical = 18.dp, |
| 78 | + horizontal = 58.dp |
| 79 | + ) |
| 80 | + ) { |
| 81 | + Text( |
| 82 | + text = stringResource(R.string.dialog_server_over_title), |
| 83 | + style = TerningTheme.typography.body6, |
| 84 | + color = Black, |
| 85 | + ) |
| 86 | + Spacer(modifier = Modifier.height(8.dp)) |
| 87 | + Text( |
| 88 | + text = stringResource(R.string.dialog_server_over_day), |
| 89 | + style = TerningTheme.typography.detail4, |
| 90 | + color = Grey500 |
| 91 | + ) |
| 92 | + } |
| 93 | + Spacer(modifier = Modifier.height(26.dp)) |
| 94 | + Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) { |
| 95 | + NoticeDialogButton( |
| 96 | + text = stringResource(R.string.dialog_dismiss), |
| 97 | + contentColor = Grey350, |
| 98 | + pressedContainerColor = Grey200, |
| 99 | + containerColor = Grey150, |
| 100 | + onClick = onDismissButtonClick, |
| 101 | + modifier = Modifier.weight(1f) |
| 102 | + ) |
| 103 | + NoticeDialogButton( |
| 104 | + text = stringResource(R.string.dialog_detail), |
| 105 | + contentColor = White, |
| 106 | + pressedContainerColor = TerningMain2, |
| 107 | + containerColor = TerningMain, |
| 108 | + onClick = onDetailButtonClick, |
| 109 | + modifier = Modifier.weight(1f) |
| 110 | + ) |
| 111 | + } |
| 112 | + } |
| 113 | + } |
| 114 | +} |
| 115 | + |
| 116 | +@Preview(showBackground = true, widthDp = 360, heightDp = 780) |
| 117 | +@Composable |
| 118 | +private fun TerningPatchUpdateDialogPreview() { |
| 119 | + TerningPointTheme { |
| 120 | + TerningServerNoticeDialog( |
| 121 | + onDismissButtonClick = {}, |
| 122 | + onDetailButtonClick = {}, |
| 123 | + ) |
| 124 | + } |
| 125 | +} |
0 commit comments