|
| 1 | +package com.ninecraft.booket.core.designsystem.component.bottomsheet |
| 2 | + |
| 3 | +import androidx.compose.foundation.layout.fillMaxWidth |
| 4 | +import androidx.compose.foundation.layout.padding |
| 5 | +import androidx.compose.foundation.shape.RoundedCornerShape |
| 6 | +import androidx.compose.material3.ExperimentalMaterial3Api |
| 7 | +import androidx.compose.material3.ModalBottomSheet |
| 8 | +import androidx.compose.material3.SheetState |
| 9 | +import androidx.compose.material3.SheetValue |
| 10 | +import androidx.compose.material3.rememberModalBottomSheetState |
| 11 | +import androidx.compose.runtime.Composable |
| 12 | +import androidx.compose.ui.Modifier |
| 13 | +import androidx.compose.ui.tooling.preview.Preview |
| 14 | +import androidx.compose.ui.unit.dp |
| 15 | +import com.ninecraft.booket.core.designsystem.component.button.ReedButton |
| 16 | +import com.ninecraft.booket.core.designsystem.component.button.ReedButtonColorStyle |
| 17 | +import com.ninecraft.booket.core.designsystem.component.button.largeButtonStyle |
| 18 | +import com.ninecraft.booket.core.designsystem.theme.ReedTheme |
| 19 | +import com.ninecraft.booket.core.designsystem.theme.White |
| 20 | + |
| 21 | +@OptIn(ExperimentalMaterial3Api::class) |
| 22 | +@Composable |
| 23 | +fun ReedBottomSheet( |
| 24 | + onDismissRequest: () -> Unit, |
| 25 | + modifier: Modifier = Modifier, |
| 26 | + sheetState: SheetState = rememberModalBottomSheetState(), |
| 27 | + content: @Composable () -> Unit, |
| 28 | +) { |
| 29 | + ModalBottomSheet( |
| 30 | + onDismissRequest = onDismissRequest, |
| 31 | + modifier = modifier, |
| 32 | + sheetState = sheetState, |
| 33 | + sheetGesturesEnabled = false, |
| 34 | + shape = RoundedCornerShape(topStart = 20.dp, topEnd = 20.dp), |
| 35 | + dragHandle = null, |
| 36 | + containerColor = White, |
| 37 | + ) { |
| 38 | + content() |
| 39 | + } |
| 40 | +} |
| 41 | + |
| 42 | +@OptIn(ExperimentalMaterial3Api::class) |
| 43 | +@Preview(showBackground = true) |
| 44 | +@Composable |
| 45 | +private fun ReedBottomSheetPreview() { |
| 46 | + val sheetState = SheetState( |
| 47 | + skipPartiallyExpanded = true, |
| 48 | + initialValue = SheetValue.Expanded, |
| 49 | + positionalThreshold = { 0f }, |
| 50 | + velocityThreshold = { 0f }, |
| 51 | + ) |
| 52 | + ReedTheme { |
| 53 | + ReedBottomSheet( |
| 54 | + sheetState = sheetState, |
| 55 | + onDismissRequest = {} |
| 56 | + ) { |
| 57 | + ReedButton( |
| 58 | + onClick = {}, |
| 59 | + modifier = Modifier.padding(10.dp).fillMaxWidth(), |
| 60 | + colorStyle = ReedButtonColorStyle.PRIMARY, |
| 61 | + sizeStyle = largeButtonStyle, |
| 62 | + text = "확인" |
| 63 | + ) |
| 64 | + } |
| 65 | + } |
| 66 | +} |
0 commit comments