-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature/#33: DetailModalBottomSheet Ui 구현
- Loading branch information
1 parent
84162dc
commit 068eb15
Showing
3 changed files
with
160 additions
and
0 deletions.
There are no files selected for viewing
147 changes: 147 additions & 0 deletions
147
...a/org/techtown/twosomeheart/presentation/detail/modal/component/DetailModalBottomSheet.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 = {} | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="56dp" | ||
android:height="12dp" | ||
android:viewportWidth="56" | ||
android:viewportHeight="12"> | ||
<path | ||
android:pathData="M6,6H50" | ||
android:strokeWidth="3" | ||
android:fillColor="#00000000" | ||
android:strokeColor="#D5D5D5" | ||
android:strokeLineCap="round"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters