From 068eb1558dd3d6880e832bb54ec5de7f13ce266d Mon Sep 17 00:00:00 2001 From: kangyein9892 Date: Wed, 27 Nov 2024 18:12:35 +0900 Subject: [PATCH] =?UTF-8?q?feature/#33:=20DetailModalBottomSheet=20Ui=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modal/component/DetailModalBottomSheet.kt | 147 ++++++++++++++++++ app/src/main/res/drawable/ic_modal_bar.xml | 12 ++ app/src/main/res/values/strings.xml | 1 + 3 files changed, 160 insertions(+) create mode 100644 app/src/main/java/org/techtown/twosomeheart/presentation/detail/modal/component/DetailModalBottomSheet.kt create mode 100644 app/src/main/res/drawable/ic_modal_bar.xml diff --git a/app/src/main/java/org/techtown/twosomeheart/presentation/detail/modal/component/DetailModalBottomSheet.kt b/app/src/main/java/org/techtown/twosomeheart/presentation/detail/modal/component/DetailModalBottomSheet.kt new file mode 100644 index 0000000..48c7f0c --- /dev/null +++ b/app/src/main/java/org/techtown/twosomeheart/presentation/detail/modal/component/DetailModalBottomSheet.kt @@ -0,0 +1,147 @@ +package org.techtown.twosomeheart.presentation.detail.modal.component + +import androidx.compose.foundation.ExperimentalFoundationApi +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +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.heightIn +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.ModalBottomSheet +import androidx.compose.material3.Text +import androidx.compose.material3.rememberModalBottomSheetState +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.platform.LocalConfiguration +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import org.techtown.twosomeheart.R +import org.techtown.twosomeheart.ui.theme.Black +import org.techtown.twosomeheart.ui.theme.TwosomeHeartTypography +import org.techtown.twosomeheart.ui.theme.White + +@OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class) +@Composable +fun DetailModalBottomSheet( + menuName: String, + onStarButtonClick: () -> Unit, + onDismissRequest: () -> Unit, + modifier: Modifier = Modifier +) { + val sheetState = rememberModalBottomSheetState() + + ModalBottomSheet( + onDismissRequest = { + onDismissRequest() + }, + sheetState = sheetState, + shape = RoundedCornerShape(topStart = 18.dp, topEnd = 18.dp), + containerColor = White, + modifier = modifier + .fillMaxWidth() + .heightIn( + min = (0.78f * LocalConfiguration.current.screenHeightDp).dp, + max = (0.87f * LocalConfiguration.current.screenHeightDp).dp + ), + dragHandle = { + Icon( + imageVector = ImageVector.vectorResource(R.drawable.ic_modal_bar), + contentDescription = stringResource(R.string.menu_detail_modal_bar), + tint = Color.Unspecified, + modifier = Modifier.padding(vertical = 6.dp) + ) + + } + ) { + Column( + modifier = Modifier.fillMaxSize() + ) { + LazyColumn( + modifier = Modifier + .fillMaxWidth() + .weight(1f) + ) { + stickyHeader { + Box( + modifier = Modifier + .fillMaxWidth() + .background(White) + ) { + Text( + text = menuName, + color = Black, + style = TwosomeHeartTypography.body1B14, + modifier = Modifier + .align(Alignment.Center) + ) + } + } + + item { + Spacer(modifier = Modifier.height(20.dp)) + + TemperatureSelection(onClick = { + + }) + + Spacer(Modifier.height(16.dp)) + + SizeSelection(onClick = { + + }) + + Spacer(Modifier.height(24.dp)) + + CoffeeBeanSelection(onClick = { + + }) + + Spacer(Modifier.height(24.dp)) + + PickUpSelection(onClick = { + + }) + + Spacer(Modifier.height(24.dp)) + + PersonalOptionSelection( + onClick = {}, + modifier = Modifier.padding(horizontal = 16.dp) + ) + } + } + + DetailModalBottomBar( + price = "1,000원", + onQuantityButtonClick = {}, + onStarButtonClick = { onStarButtonClick() }, + isEnabled = true, + modifier = modifier + .fillMaxWidth() + ) + } + } +} + + +@Preview +@Composable +fun DetailModalBottomSheetPreview() { + DetailModalBottomSheet( + menuName = "바나나 샷 라떼", + onStarButtonClick = {}, + onDismissRequest = {} + ) +} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_modal_bar.xml b/app/src/main/res/drawable/ic_modal_bar.xml new file mode 100644 index 0000000..f07397b --- /dev/null +++ b/app/src/main/res/drawable/ic_modal_bar.xml @@ -0,0 +1,12 @@ + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index db78eb6..285cd03 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -56,5 +56,6 @@ 개인컵 사용 안내 퍼스널 옵션 장바구니 + 모달 바텀 버튼