diff --git a/Prezel/app/src/main/java/com/team/prezel/ui/DoubleBackToExitHandler.kt b/Prezel/app/src/main/java/com/team/prezel/ui/DoubleBackToExitHandler.kt index 711a582b..182126b8 100644 --- a/Prezel/app/src/main/java/com/team/prezel/ui/DoubleBackToExitHandler.kt +++ b/Prezel/app/src/main/java/com/team/prezel/ui/DoubleBackToExitHandler.kt @@ -10,8 +10,8 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.platform.LocalResources import com.team.prezel.R -import com.team.prezel.core.designsystem.component.snackbar.dismissById -import com.team.prezel.core.designsystem.component.snackbar.showPrezelSnackbar +import com.team.prezel.core.designsystem.component.modal.snackbar.dismissById +import com.team.prezel.core.designsystem.component.modal.snackbar.showPrezelSnackbar import com.team.prezel.core.navigation.NavigationState import com.team.prezel.core.ui.LocalSnackbarHostState diff --git a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/PrezelNavigationBar.kt b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/PrezelNavigationBar.kt index 17d92030..36c67036 100644 --- a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/PrezelNavigationBar.kt +++ b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/PrezelNavigationBar.kt @@ -29,7 +29,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.dp -import com.team.prezel.core.designsystem.component.snackbar.PrezelSnackbarHost +import com.team.prezel.core.designsystem.component.modal.snackbar.PrezelSnackbarHost import com.team.prezel.core.designsystem.icon.PrezelIcons import com.team.prezel.core.designsystem.preview.BasicPreview import com.team.prezel.core.designsystem.theme.PrezelTheme diff --git a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/modal/dialog/PrezelDialog.kt b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/modal/dialog/PrezelDialog.kt new file mode 100644 index 00000000..c76e6db4 --- /dev/null +++ b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/modal/dialog/PrezelDialog.kt @@ -0,0 +1,108 @@ +package com.team.prezel.core.designsystem.component.modal.dialog + +import androidx.compose.foundation.background +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.Spacer +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.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.window.Dialog +import androidx.compose.ui.window.DialogProperties +import com.team.prezel.core.designsystem.preview.BasicPreview +import com.team.prezel.core.designsystem.theme.PrezelTheme + +@Composable +fun PrezelDialog( + title: String, + description: String, + onDismiss: () -> Unit, + modifier: Modifier = Modifier, + content: @Composable PrezelDialogScope.() -> Unit, +) { + val scope = remember { PrezelDialogScope() } + + Dialog( + onDismissRequest = onDismiss, + properties = DialogProperties( + dismissOnClickOutside = false, + usePlatformDefaultWidth = false, + ), + ) { + Column( + modifier = modifier + .fillMaxWidth() + .padding(horizontal = PrezelTheme.spacing.V20) + .clip(shape = PrezelTheme.shapes.V12) + .background(color = PrezelTheme.colors.bgRegular) + .padding(horizontal = PrezelTheme.spacing.V24), + ) { + DialogContent( + title = title, + description = description, + ) + + ActionSection { scope.content() } + } + } +} + +@Composable +private fun DialogContent( + title: String, + description: String, + modifier: Modifier = Modifier, +) { + Column( + modifier = modifier.padding(vertical = PrezelTheme.spacing.V24), + ) { + Text(text = title, style = PrezelTheme.typography.title2Bold, color = PrezelTheme.colors.textLarge) + Spacer(modifier = Modifier.height(PrezelTheme.spacing.V12)) + Text(text = description, style = PrezelTheme.typography.body3Medium, color = PrezelTheme.colors.textRegular) + } +} + +@Composable +private fun ActionSection( + modifier: Modifier = Modifier, + content: @Composable () -> Unit, +) { + Box( + modifier = modifier + .fillMaxWidth() + .padding(bottom = PrezelTheme.spacing.V20), + ) { + Row( + modifier = Modifier.align(Alignment.CenterEnd), + horizontalArrangement = Arrangement.spacedBy(PrezelTheme.spacing.V32), + ) { + content() + } + } +} + +@BasicPreview +@Composable +private fun PrezelDialogPreview() { + PrezelTheme { + Box(modifier = Modifier.fillMaxSize()) { + PrezelDialog( + title = "Title", + description = "Description", + onDismiss = {}, + ) { + Action(label = "Action2") {} + Action(label = "Action1", type = PrezelDialogScope.ActionType.GOOD) {} + } + } + } +} diff --git a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/modal/dialog/PrezelDialogScope.kt b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/modal/dialog/PrezelDialogScope.kt new file mode 100644 index 00000000..40ae94b3 --- /dev/null +++ b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/modal/dialog/PrezelDialogScope.kt @@ -0,0 +1,77 @@ +package com.team.prezel.core.designsystem.component.modal.dialog + +import androidx.compose.foundation.layout.LayoutScopeMarker +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.semantics.Role +import androidx.compose.ui.semantics.role +import androidx.compose.ui.semantics.semantics +import com.team.prezel.core.designsystem.component.base.PrezelTouchArea +import com.team.prezel.core.designsystem.preview.BasicPreview +import com.team.prezel.core.designsystem.preview.PreviewSection +import com.team.prezel.core.designsystem.preview.PreviewValueRow +import com.team.prezel.core.designsystem.theme.PrezelTheme + +@LayoutScopeMarker +class PrezelDialogScope { + enum class ActionType { + DEFAULT, + GOOD, + BAD, + } + + @Composable + fun Action( + label: String, + type: ActionType = ActionType.DEFAULT, + onClick: () -> Unit, + ) { + val labelColor = labelColor(type = type) + + PrezelTouchArea( + onClick = onClick, + shape = PrezelTheme.shapes.V4, + modifier = Modifier.semantics { role = Role.Button }, + ) { + Text( + text = label, + style = PrezelTheme.typography.body2Medium, + color = labelColor, + modifier = Modifier.padding(vertical = PrezelTheme.spacing.V8), + ) + } + } + + @Composable + private fun labelColor(type: ActionType) = + when (type) { + ActionType.DEFAULT -> PrezelTheme.colors.textRegular + ActionType.GOOD -> PrezelTheme.colors.feedbackGoodRegular + ActionType.BAD -> PrezelTheme.colors.feedbackBadRegular + } +} + +@BasicPreview +@Composable +private fun PrezelDialogActionPreview() { + PrezelTheme { + PreviewSection( + title = "Dialog Action", + description = "Dialog에 사용되는 리소스입니다.", + ) { + with(PrezelDialogScope()) { + PreviewValueRow(name = "Default Action") { + Action(label = "Action", type = PrezelDialogScope.ActionType.DEFAULT) {} + } + PreviewValueRow(name = "Good Action") { + Action(label = "Action", type = PrezelDialogScope.ActionType.GOOD) {} + } + PreviewValueRow(name = "Bad Action") { + Action(label = "Action", type = PrezelDialogScope.ActionType.BAD) {} + } + } + } + } +} diff --git a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/snackbar/PrezelSnackbar.kt b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/modal/snackbar/PrezelSnackbar.kt similarity index 98% rename from Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/snackbar/PrezelSnackbar.kt rename to Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/modal/snackbar/PrezelSnackbar.kt index 9b0bb701..04510ca2 100644 --- a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/snackbar/PrezelSnackbar.kt +++ b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/modal/snackbar/PrezelSnackbar.kt @@ -1,4 +1,4 @@ -package com.team.prezel.core.designsystem.component.snackbar +package com.team.prezel.core.designsystem.component.modal.snackbar import androidx.annotation.DrawableRes import androidx.compose.foundation.layout.Row diff --git a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/snackbar/SnackbarHost.kt b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/modal/snackbar/SnackbarHost.kt similarity index 96% rename from Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/snackbar/SnackbarHost.kt rename to Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/modal/snackbar/SnackbarHost.kt index 41d297ac..30a94fce 100644 --- a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/snackbar/SnackbarHost.kt +++ b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/modal/snackbar/SnackbarHost.kt @@ -1,4 +1,4 @@ -package com.team.prezel.core.designsystem.component.snackbar +package com.team.prezel.core.designsystem.component.modal.snackbar import androidx.annotation.DrawableRes import androidx.compose.material3.SnackbarDuration diff --git a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/theme/PrezelTheme.kt b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/theme/PrezelTheme.kt index 5871eb49..c775a347 100644 --- a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/theme/PrezelTheme.kt +++ b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/theme/PrezelTheme.kt @@ -69,7 +69,7 @@ fun PrezelTheme( LocalPrezelSpacing provides PrezelSpacing, LocalPrezelStroke provides PrezelStroke, LocalTextStyle provides typographyScheme.body3Regular, - LocalContentColor provides colorScheme.textLarge, + LocalContentColor provides colorScheme.textRegular, content = content, ) } diff --git a/Prezel/feature/login/impl/src/main/java/com/team/prezel/feature/login/impl/landing/LoginScreen.kt b/Prezel/feature/login/impl/src/main/java/com/team/prezel/feature/login/impl/landing/LoginScreen.kt index 67a8a4c0..bb6ebecc 100644 --- a/Prezel/feature/login/impl/src/main/java/com/team/prezel/feature/login/impl/landing/LoginScreen.kt +++ b/Prezel/feature/login/impl/src/main/java/com/team/prezel/feature/login/impl/landing/LoginScreen.kt @@ -36,7 +36,7 @@ import com.team.prezel.core.designsystem.component.actions.button.config.ButtonH import com.team.prezel.core.designsystem.component.actions.button.config.ButtonSize import com.team.prezel.core.designsystem.component.actions.button.config.ButtonType import com.team.prezel.core.designsystem.component.actions.button.config.PrezelButtonDefaults -import com.team.prezel.core.designsystem.component.snackbar.showPrezelSnackbar +import com.team.prezel.core.designsystem.component.modal.snackbar.showPrezelSnackbar import com.team.prezel.core.designsystem.icon.PrezelIcons import com.team.prezel.core.designsystem.preview.BasicPreview import com.team.prezel.core.designsystem.theme.PrezelTheme