Skip to content

Commit

Permalink
Boolti-312 refactor: BtAppBar 커밋 형태 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
mangbaam committed Oct 19, 2024
1 parent 4597648 commit 8f94683
Showing 1 changed file with 11 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,32 +80,26 @@ fun BtAppBar(
modifier: Modifier = Modifier,
title: String = "",
colors: BtAppBarColors = BtAppBarDefaults.appBarColors(),
navigationButtonIds: List<Int> = emptyList(),
actionButtonIds: List<Int> = emptyList(),
onClickNavigationButton: (index: Int) -> Unit = {},
onClickActionButton: (index: Int) -> Unit = {},
navigationButtons: List<Pair<Int, () -> Unit>> = emptyList(),
actionButtons: List<Pair<Int, () -> Unit>> = emptyList(),
) {
BtAppBar(
modifier = modifier,
title = title,
colors = colors,
navigateButtons = if (navigationButtonIds.isNotEmpty()) {
navigateButtons = if (navigationButtons.isNotEmpty()) {
{
navigationButtonIds.forEachIndexed { i, res ->
BtAppBarDefaults.AppBarIconButton(res) {
onClickNavigationButton(i)
}
navigationButtons.forEach { (res, onClick) ->
BtAppBarDefaults.AppBarIconButton(iconRes = res, onClick = onClick)
}
}
} else {
null
},
actionButtons = if (actionButtonIds.isNotEmpty()) {
actionButtons = if (actionButtons.isNotEmpty()) {
{
actionButtonIds.forEachIndexed { i, res ->
BtAppBarDefaults.AppBarIconButton(res) {
onClickActionButton(i)
}
actionButtons.forEach { (res, onClick) ->
BtAppBarDefaults.AppBarIconButton(iconRes = res, onClick = onClick)
}
}
} else {
Expand Down Expand Up @@ -280,13 +274,9 @@ private fun AppBar2Preview() {
BooltiTheme {
Surface {
BtAppBar(
navigationButtonIds = listOf(
R.drawable.ic_arrow_back,
R.drawable.ic_home,
),
actionButtonIds = listOf(
R.drawable.ic_share,
R.drawable.ic_verticle_more,
navigationButtons = listOf(
R.drawable.ic_arrow_back to { /* clicked */ },
R.drawable.ic_home to { /* clicked */ },
),
)
}
Expand Down

0 comments on commit 8f94683

Please sign in to comment.