From 0dcc64c06d8bf2597b29d7f173ea4050284fdc2e Mon Sep 17 00:00:00 2001 From: HamBP Date: Tue, 14 Jan 2025 23:38:58 +0900 Subject: [PATCH] =?UTF-8?q?feat=20:=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=20?= =?UTF-8?q?=EB=8B=A4=EC=9D=B4=EC=96=B4=EB=A1=9C=EA=B7=B8=20=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/screen/show/EventDialog.kt | 145 ++++++++++++++++++ presentation/src/main/res/values/strings.xml | 1 + 2 files changed, 146 insertions(+) create mode 100644 presentation/src/main/java/com/nexters/boolti/presentation/screen/show/EventDialog.kt diff --git a/presentation/src/main/java/com/nexters/boolti/presentation/screen/show/EventDialog.kt b/presentation/src/main/java/com/nexters/boolti/presentation/screen/show/EventDialog.kt new file mode 100644 index 00000000..6cde974e --- /dev/null +++ b/presentation/src/main/java/com/nexters/boolti/presentation/screen/show/EventDialog.kt @@ -0,0 +1,145 @@ +package com.nexters.boolti.presentation.screen.show + +import androidx.compose.foundation.background +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxHeight +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.foundation.layout.size +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Card +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color.Companion.White +import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.platform.LocalUriHandler +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.compose.ui.window.Dialog +import androidx.compose.ui.window.DialogProperties +import coil.compose.AsyncImage +import com.nexters.boolti.presentation.R +import com.nexters.boolti.presentation.component.BtCheckBox +import com.nexters.boolti.presentation.theme.BooltiTheme +import com.nexters.boolti.presentation.theme.Grey50 +import com.nexters.boolti.presentation.theme.Grey95 + +@Composable +fun BTDialog( + imageUrl: String, + actionUrl: String?, + onDismiss: (hideToday: Boolean) -> Unit, +) { + var hideToday by rememberSaveable { mutableStateOf(false) } + val uriHandler = LocalUriHandler.current + + Dialog( + properties = DialogProperties( + usePlatformDefaultWidth = false, + ), + onDismissRequest = { onDismiss(hideToday) } + ) { + Card( + modifier = Modifier.width(311.dp), + shape = RoundedCornerShape(8.dp), + ) { + Column { + Box( + modifier = Modifier + .fillMaxWidth() + .height(360.dp) + .then( + if (actionUrl == null) { + Modifier + } else { + Modifier.clickable { + uriHandler.openUri(actionUrl) + } + } + ) + ) { + AsyncImage( + model = imageUrl, + contentDescription = stringResource(id = R.string.description_event_poster), + modifier = Modifier.fillMaxSize(), + contentScale = ContentScale.Crop, + ) + } + Row( + modifier = Modifier + .fillMaxWidth() + .height(56.dp) + .background(color = White), + horizontalArrangement = Arrangement.SpaceBetween, + verticalAlignment = Alignment.CenterVertically, + ) { + Row( + modifier = Modifier + .fillMaxHeight() + .clickable(onClick = { hideToday = !hideToday }) + .padding(horizontal = 20.dp), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(4.dp), + ) { + Box( + modifier = Modifier.size(24.dp), + contentAlignment = Alignment.Center, + ) { + BtCheckBox( + isSelected = hideToday + ) + } + Text( + text = "오늘 하루 그만 보기", + style = MaterialTheme.typography.bodyLarge.copy(color = Grey50) + ) + } + Box( + modifier = Modifier + .fillMaxHeight() + .width(68.dp) + .clickable(onClick = { onDismiss(hideToday) }), + contentAlignment = Alignment.Center + ) { + Text( + text = stringResource(R.string.description_close_button), + style = MaterialTheme.typography.bodyLarge.copy(color = Grey95), + textAlign = TextAlign.Center, + ) + } + } + } + } + } +} + +@Preview(widthDp = 360, heightDp = 760) +@Composable +fun BTDialogPreview() { + BooltiTheme { + Surface { + BTDialog( + imageUrl = "", + actionUrl = "", + onDismiss = {} + ) + } + } +} diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index ca164b63..64b0b3e0 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -7,6 +7,7 @@ 뒤로 가기 포스터 사진 + 이벤트 포스터 유저 섬네일 닫기 홈으로 이동