11package com.yapp.ndgl.core.ui.designsystem
22
3+ import androidx.compose.foundation.clickable
34import androidx.compose.foundation.layout.Column
45import androidx.compose.foundation.layout.ColumnScope
6+ import androidx.compose.foundation.layout.Row
7+ import androidx.compose.foundation.layout.Spacer
58import androidx.compose.foundation.layout.fillMaxWidth
69import androidx.compose.foundation.layout.padding
10+ import androidx.compose.foundation.layout.size
11+ import androidx.compose.foundation.shape.CircleShape
712import androidx.compose.foundation.shape.RoundedCornerShape
813import androidx.compose.material3.BottomSheetDefaults
914import androidx.compose.material3.ExperimentalMaterial3Api
15+ import androidx.compose.material3.Icon
1016import androidx.compose.material3.ModalBottomSheet
1117import androidx.compose.material3.Text
1218import androidx.compose.material3.rememberModalBottomSheetState
1319import androidx.compose.runtime.Composable
1420import androidx.compose.ui.Modifier
21+ import androidx.compose.ui.draw.clip
22+ import androidx.compose.ui.graphics.vector.ImageVector
23+ import androidx.compose.ui.res.vectorResource
1524import androidx.compose.ui.tooling.preview.Preview
1625import androidx.compose.ui.unit.dp
26+ import com.yapp.ndgl.core.ui.R
1727import com.yapp.ndgl.core.ui.theme.NDGLTheme
1828
1929@OptIn(ExperimentalMaterial3Api ::class )
@@ -22,6 +32,7 @@ fun NDGLBottomSheet(
2232 modifier : Modifier = Modifier ,
2333 onDismissRequest : () -> Unit ,
2434 showDragHandle : Boolean = true,
35+ title : String? = null,
2536 content : @Composable ColumnScope .() -> Unit ,
2637) {
2738 val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true )
@@ -37,8 +48,31 @@ fun NDGLBottomSheet(
3748 },
3849 containerColor = NDGLTheme .colors.white,
3950 shape = RoundedCornerShape (topStart = 16 .dp, topEnd = 16 .dp),
40- content = content,
41- )
51+ ) {
52+ title?.let { title ->
53+ Row (
54+ modifier = Modifier
55+ .fillMaxWidth()
56+ .padding(vertical = 18 .dp, horizontal = 24 .dp),
57+ ) {
58+ Text (title, color = NDGLTheme .colors.black400, style = NDGLTheme .typography.bodyLgMedium)
59+ Spacer (Modifier .weight(1f ))
60+ Icon (
61+ imageVector = ImageVector .vectorResource(R .drawable.ic_24_close),
62+ contentDescription = null ,
63+ tint = NDGLTheme .colors.black600,
64+ modifier = Modifier
65+ .size(24 .dp)
66+ .clip(shape = CircleShape )
67+ .clickable {
68+ onDismissRequest()
69+ },
70+ )
71+ }
72+ }
73+
74+ content()
75+ }
4276}
4377
4478@Preview(showBackground = true )
@@ -48,20 +82,15 @@ private fun NDGLBottomSheetWithHandlePreview() {
4882 NDGLBottomSheet (
4983 onDismissRequest = {},
5084 showDragHandle = true ,
85+ title = " 바텀시트 제목" ,
5186 ) {
5287 Column (
5388 modifier = Modifier
5489 .fillMaxWidth()
5590 .padding(24 .dp),
5691 ) {
57- Text (
58- text = " 바텀시트 제목" ,
59- style = NDGLTheme .typography.subtitleLgSemiBold,
60- color = NDGLTheme .colors.black900,
61- )
6292 Text (
6393 text = " 바텀시트 내용입니다." ,
64- modifier = Modifier .padding(top = 16 .dp),
6594 style = NDGLTheme .typography.bodyLgMedium,
6695 color = NDGLTheme .colors.black500,
6796 )
@@ -77,20 +106,15 @@ private fun NDGLBottomSheetWithoutHandlePreview() {
77106 NDGLBottomSheet (
78107 onDismissRequest = {},
79108 showDragHandle = false ,
109+ title = " 바텀시트 제목" ,
80110 ) {
81111 Column (
82112 modifier = Modifier
83113 .fillMaxWidth()
84114 .padding(24 .dp),
85115 ) {
86- Text (
87- text = " 바텀시트 제목" ,
88- style = NDGLTheme .typography.subtitleLgSemiBold,
89- color = NDGLTheme .colors.black900,
90- )
91116 Text (
92117 text = " 바텀시트 내용입니다." ,
93- modifier = Modifier .padding(top = 16 .dp),
94118 style = NDGLTheme .typography.bodyLgMedium,
95119 color = NDGLTheme .colors.black500,
96120 )
0 commit comments