From b80281e86b4e6a6d4baff24fd1ed3713638e279d Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Thu, 16 Jan 2025 08:51:01 +0900 Subject: [PATCH] =?UTF-8?q?[FEAT/#24]=20AdvancedBottomSheet=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bottomsheet/SpoonyAdvancedBottomSheet.kt | 53 +++++++++++++++++++ .../designsystem/type/AdvancedSheetState.kt | 7 +++ 2 files changed, 60 insertions(+) create mode 100644 app/src/main/java/com/spoony/spoony/core/designsystem/component/bottomsheet/SpoonyAdvancedBottomSheet.kt create mode 100644 app/src/main/java/com/spoony/spoony/core/designsystem/type/AdvancedSheetState.kt diff --git a/app/src/main/java/com/spoony/spoony/core/designsystem/component/bottomsheet/SpoonyAdvancedBottomSheet.kt b/app/src/main/java/com/spoony/spoony/core/designsystem/component/bottomsheet/SpoonyAdvancedBottomSheet.kt new file mode 100644 index 0000000..6d6e121 --- /dev/null +++ b/app/src/main/java/com/spoony/spoony/core/designsystem/component/bottomsheet/SpoonyAdvancedBottomSheet.kt @@ -0,0 +1,53 @@ +package com.spoony.spoony.core.designsystem.component.bottomsheet + +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.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp +import com.spoony.spoony.core.designsystem.theme.SpoonyAndroidTheme +import com.spoony.spoony.core.designsystem.type.AdvancedSheetState +import io.morfly.compose.bottomsheet.material3.BottomSheetScaffold +import io.morfly.compose.bottomsheet.material3.BottomSheetScaffoldState + +@OptIn(ExperimentalFoundationApi::class, ExperimentalMaterial3Api::class) +@Composable +fun SpoonyAdvancedBottomSheet( + sheetState: BottomSheetScaffoldState, + sheetContent: @Composable () -> Unit, + modifier: Modifier = Modifier, + dragHandle: @Composable () -> Unit = {}, + content: @Composable () -> Unit +) { + BottomSheetScaffold( + scaffoldState = sheetState, + sheetContent = { + sheetContent() + }, + modifier = modifier, + sheetDragHandle = { + Column( + horizontalAlignment = Alignment.CenterHorizontally + ) { + Box( + modifier = Modifier + .width(24.dp) + .height(Dp.Hairline.plus(2.dp)) + .padding(top = 12.dp) + .background(SpoonyAndroidTheme.colors.gray300) + ) + dragHandle() + } + } + ) { + content() + } +} diff --git a/app/src/main/java/com/spoony/spoony/core/designsystem/type/AdvancedSheetState.kt b/app/src/main/java/com/spoony/spoony/core/designsystem/type/AdvancedSheetState.kt new file mode 100644 index 0000000..28bdaec --- /dev/null +++ b/app/src/main/java/com/spoony/spoony/core/designsystem/type/AdvancedSheetState.kt @@ -0,0 +1,7 @@ +package com.spoony.spoony.core.designsystem.type + +enum class AdvancedSheetState { + Hidden, + PartiallyExpanded, + Expanded +}