-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat] Bottom Sheet 컴포넌트 구현 #27
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2d37fff
[feat] #16 BbangZipBasicModalBottomSheet 구현
HAJIEUN02 2c6e7b4
[mod] #16 BbangZipBasicModalBottomSheet 인자 네이밍 및 ui 수정
HAJIEUN02 7b18eaa
[feat] #16 BbangZipListPickerBottomSheet 구현
HAJIEUN02 5b71e4d
[feat] #16 BbangZipListDefaultPickerBottomSheet 구현
HAJIEUN02 671e614
[feat] #16 BbangZipTwoButtonBottomSheet 구현
HAJIEUN02 8b54751
[feat] #16 BbangZipDatePickerBottomSheet 구현
HAJIEUN02 09ee028
[feat] #16 BbangZipOneButtonBottomSheet 구현
HAJIEUN02 ebbdf53
[chore] #16 ktlint 적용
HAJIEUN02 52b4c9b
[feat] #16 ExamDate model 구현
HAJIEUN02 ab47f36
[chore] #16 Bottom Sheet 패키지 이동
HAJIEUN02 491f92d
Merge remote-tracking branch 'origin/develop' into feat/component-bot…
HAJIEUN02 7dc56e8
[mod] #16 background 뒤 클릭 시 내려가도록 수정
HAJIEUN02 2eac99b
[chore] #16 ktlint 체크
HAJIEUN02 e95a652
[chore] #16 ktlint 체크
HAJIEUN02 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
86 changes: 86 additions & 0 deletions
86
.../org/android/bbangzip/presentation/component/bottomsheet/BbangZipBasicModalBottomSheet.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,86 @@ | ||
package org.android.bbangzip.presentation.component.bottomsheet | ||
|
||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.ColumnScope | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.ModalBottomSheet | ||
import androidx.compose.material3.SheetState | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.rememberModalBottomSheetState | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.saveable.rememberSaveable | ||
import androidx.compose.runtime.setValue | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import org.android.bbangzip.ui.theme.BBANGZIPTheme | ||
import org.android.bbangzip.ui.theme.BbangZipTheme | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun BbangZipBasicModalBottomSheet( | ||
isBottomSheetVisible: Boolean, | ||
onDismissRequest: () -> Unit, | ||
modifier: Modifier = Modifier, | ||
sheetState: SheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true), | ||
title: @Composable (ColumnScope.() -> Unit) = {}, | ||
content: @Composable (ColumnScope.() -> Unit) = {}, | ||
interactButton: @Composable (ColumnScope.() -> Unit) = {}, | ||
cancelButton: @Composable (ColumnScope.() -> Unit) = {}, | ||
) { | ||
if (isBottomSheetVisible) { | ||
ModalBottomSheet( | ||
onDismissRequest = onDismissRequest, | ||
sheetState = sheetState, | ||
shape = RoundedCornerShape(topStart = 48.dp, topEnd = 48.dp), | ||
containerColor = BbangZipTheme.colors.backgroundNormal_FFFFFF, | ||
scrimColor = BbangZipTheme.colors.materialDimmer_282119_52, | ||
) { | ||
Column( | ||
modifier = | ||
modifier | ||
.fillMaxWidth() | ||
.padding(horizontal = 16.dp), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
) { | ||
title() | ||
content() | ||
interactButton() | ||
cancelButton() | ||
} | ||
} | ||
} | ||
} | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Preview | ||
@Composable | ||
private fun BasicModalBottomSheetPreview() { | ||
BBANGZIPTheme { | ||
var isBottomSheetVisible by rememberSaveable { mutableStateOf(true) } | ||
|
||
BbangZipBasicModalBottomSheet( | ||
modifier = Modifier.padding(horizontal = 14.dp), | ||
isBottomSheetVisible = isBottomSheetVisible, | ||
onDismissRequest = { isBottomSheetVisible = !isBottomSheetVisible }, | ||
title = { | ||
Text( | ||
text = "BbangZip Basic Modal Bottom Sheet Title", | ||
modifier = | ||
Modifier | ||
.align(Alignment.CenterHorizontally) | ||
.padding(vertical = 15.dp), | ||
) | ||
}, | ||
content = { | ||
Text(text = "BbangZip Basic Modal Bottom Sheet Content") | ||
}, | ||
) | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
.../org/android/bbangzip/presentation/component/bottomsheet/BbangZipDatePickerBottomSheet.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,71 @@ | ||
package org.android.bbangzip.presentation.component.bottomsheet | ||
|
||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.saveable.rememberSaveable | ||
import androidx.compose.runtime.setValue | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import org.android.bbangzip.presentation.model.Date | ||
import org.android.bbangzip.ui.theme.BbangZipTheme | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun BbangZipDatePickerBottomSheet( | ||
isBottomSheetVisible: Boolean, | ||
modifier: Modifier = Modifier, | ||
bottomSheetTitle: String, | ||
selectedDate: Date? = null, | ||
onSelectedDateChanged: (Date) -> Unit = {}, | ||
onClickInputButton: (Date) -> Unit = {}, | ||
onDismissRequest: () -> Unit = {}, | ||
) { | ||
BbangZipBasicModalBottomSheet( | ||
modifier = modifier, | ||
isBottomSheetVisible = isBottomSheetVisible, | ||
onDismissRequest = onDismissRequest, | ||
title = { | ||
Text( | ||
text = bottomSheetTitle, | ||
modifier = | ||
Modifier | ||
.align(Alignment.CenterHorizontally) | ||
.padding(vertical = 15.dp), | ||
style = BbangZipTheme.typography.headline1Bold, | ||
color = BbangZipTheme.colors.labelNeutral_282119_88, | ||
) | ||
}, | ||
content = { | ||
Spacer(modifier = Modifier.height(24.dp)) | ||
|
||
// TODO Picker 넣기, padding horizontal 24 넣기 | ||
|
||
Spacer(modifier = Modifier.height(24.dp)) | ||
}, | ||
interactButton = { | ||
// TODO Button 넣기, Button 클릭 시에 onClickInputButton() 전달 | ||
|
||
Spacer(modifier = Modifier.height(16.dp)) | ||
}, | ||
) | ||
} | ||
|
||
@Preview(showBackground = true) | ||
@Composable | ||
private fun BbangZipDatePickerBottomSheetPreview() { | ||
var isBottomSheetVisible by rememberSaveable { mutableStateOf(true) } | ||
|
||
BbangZipDatePickerBottomSheet( | ||
isBottomSheetVisible = isBottomSheetVisible, | ||
bottomSheetTitle = "언제까지 공부할까요?", | ||
onDismissRequest = { isBottomSheetVisible = !isBottomSheetVisible }, | ||
) | ||
} |
98 changes: 98 additions & 0 deletions
98
...droid/bbangzip/presentation/component/bottomsheet/BbangZipListDefaultPickerBottomSheet.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,98 @@ | ||
package org.android.bbangzip.presentation.component.bottomsheet | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.ColumnScope | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.lazy.LazyColumn | ||
import androidx.compose.foundation.lazy.itemsIndexed | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableIntStateOf | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.saveable.rememberSaveable | ||
import androidx.compose.runtime.setValue | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import org.android.bbangzip.presentation.util.modifier.applyFilterOnClick | ||
import org.android.bbangzip.ui.theme.BBANGZIPTheme | ||
import org.android.bbangzip.ui.theme.BbangZipTheme | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun BbangZipListDefaultPickerBottomSheet( | ||
isBottomSheetVisible: Boolean, | ||
itemList: List<String>, | ||
modifier: Modifier = Modifier, | ||
title: @Composable (ColumnScope.() -> Unit) = {}, | ||
selectedItem: Int = 0, | ||
onSelectedItemChanged: (Int) -> Unit = {}, | ||
onDismissRequest: () -> Unit = {}, | ||
) { | ||
BbangZipBasicModalBottomSheet( | ||
modifier = modifier, | ||
isBottomSheetVisible = isBottomSheetVisible, | ||
onDismissRequest = onDismissRequest, | ||
title = { title() }, | ||
content = { | ||
LazyColumn( | ||
modifier = Modifier.padding(top = 8.dp, bottom = 24.dp), | ||
verticalArrangement = Arrangement.spacedBy(8.dp), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
) { | ||
itemsIndexed( | ||
itemList, | ||
key = { _, item -> item }, | ||
) { index, item -> | ||
Text( | ||
text = itemList[index], | ||
modifier = | ||
Modifier | ||
.fillMaxWidth() | ||
.applyFilterOnClick { onSelectedItemChanged(index) } | ||
.background( | ||
color = if (index != selectedItem) BbangZipTheme.colors.staticWhite_FFFFFF else BbangZipTheme.colors.fillStrong_68645E_16, | ||
shape = RoundedCornerShape(16.dp), | ||
) | ||
.padding(vertical = 8.dp), | ||
textAlign = TextAlign.Center, | ||
style = BbangZipTheme.typography.body1Bold, | ||
color = BbangZipTheme.colors.labelNormal_282119, | ||
) | ||
} | ||
} | ||
}, | ||
) | ||
} | ||
|
||
@Preview(showBackground = true) | ||
@Composable | ||
private fun BbangZipListDefaultPickerBottomSheetPreview() { | ||
var isBottomSheetVisible by rememberSaveable { mutableStateOf(true) } | ||
var selectedSort by rememberSaveable { mutableIntStateOf(0) } | ||
|
||
BBANGZIPTheme { | ||
BbangZipListDefaultPickerBottomSheet( | ||
isBottomSheetVisible = isBottomSheetVisible, | ||
onDismissRequest = { isBottomSheetVisible = !isBottomSheetVisible }, | ||
itemList = | ||
listOf( | ||
"최근 등록 순", | ||
"분량 적은 순", | ||
"마감 기한 빠른 순", | ||
), | ||
selectedItem = 1, | ||
onSelectedItemChanged = { index -> | ||
selectedSort = index | ||
isBottomSheetVisible = !isBottomSheetVisible | ||
}, | ||
) | ||
} | ||
} |
103 changes: 103 additions & 0 deletions
103
.../org/android/bbangzip/presentation/component/bottomsheet/BbangZipListPickerBottomSheet.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,103 @@ | ||
package org.android.bbangzip.presentation.component.bottomsheet | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.ColumnScope | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.lazy.LazyColumn | ||
import androidx.compose.foundation.lazy.itemsIndexed | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.saveable.rememberSaveable | ||
import androidx.compose.runtime.setValue | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import org.android.bbangzip.presentation.util.modifier.applyFilterOnClick | ||
import org.android.bbangzip.ui.theme.BBANGZIPTheme | ||
import org.android.bbangzip.ui.theme.BbangZipTheme | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun BbangZipListPickerBottomSheet( | ||
isBottomSheetVisible: Boolean, | ||
itemList: List<String>, | ||
modifier: Modifier = Modifier, | ||
title: @Composable (ColumnScope.() -> Unit) = {}, | ||
onSelectedItemChanged: (Int) -> Unit = {}, | ||
onDismissRequest: () -> Unit = {}, | ||
) { | ||
BbangZipBasicModalBottomSheet( | ||
modifier = modifier, | ||
isBottomSheetVisible = isBottomSheetVisible, | ||
onDismissRequest = onDismissRequest, | ||
title = { title() }, | ||
content = { | ||
LazyColumn( | ||
modifier = Modifier.padding(vertical = 24.dp), | ||
verticalArrangement = Arrangement.spacedBy(8.dp), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
) { | ||
itemsIndexed( | ||
itemList, | ||
key = { _, item -> item }, | ||
) { index, item -> | ||
Text( | ||
text = itemList[index], | ||
modifier = | ||
Modifier | ||
.fillMaxWidth() | ||
.padding(vertical = 8.dp) | ||
.applyFilterOnClick { onSelectedItemChanged(index) }, | ||
textAlign = TextAlign.Center, | ||
style = BbangZipTheme.typography.body1Bold, | ||
color = BbangZipTheme.colors.labelNormal_282119, | ||
) | ||
} | ||
} | ||
}, | ||
) | ||
} | ||
|
||
@Preview(showBackground = true) | ||
@Composable | ||
private fun BbangZipListPickerBottomSheetPreview() { | ||
var isBottomSheetVisible by rememberSaveable { mutableStateOf(true) } | ||
var selectedPiece by rememberSaveable { mutableStateOf<Int?>(null) } | ||
|
||
BBANGZIPTheme { | ||
BbangZipListPickerBottomSheet( | ||
isBottomSheetVisible = isBottomSheetVisible, | ||
title = { | ||
Text( | ||
text = "몇 조각으로 쪼개서 공부할까요?", | ||
modifier = | ||
Modifier | ||
.align(Alignment.CenterHorizontally) | ||
.padding(vertical = 15.dp), | ||
style = BbangZipTheme.typography.headline1Bold, | ||
color = BbangZipTheme.colors.labelNeutral_282119_88, | ||
) | ||
}, | ||
onDismissRequest = { isBottomSheetVisible = !isBottomSheetVisible }, | ||
itemList = | ||
listOf( | ||
"1조각", | ||
"2조각", | ||
"3조각", | ||
"4조각", | ||
"5조각", | ||
"6조각", | ||
), | ||
onSelectedItemChanged = { index -> | ||
selectedPiece = index | ||
isBottomSheetVisible = !isBottomSheetVisible | ||
}, | ||
) | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
p5
얘정도면 슬롯이라해도 상관없겠죠?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
마자여 슬롯 역할이에용가리