Skip to content

Commit

Permalink
[REFACTOR] #50 : TopBar Row -> Box 로 변경, text 가운데 정렬
Browse files Browse the repository at this point in the history
  • Loading branch information
tgyuuAn committed Nov 29, 2023
1 parent 4a55a03 commit 8dd3bb6
Showing 1 changed file with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ package com.wap.designsystem.component
import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
Expand Down Expand Up @@ -35,38 +34,38 @@ fun WappTopBar(
@DrawableRes leftButtonDrawableRes: Int = R.drawable.ic_back,
@DrawableRes rightButtonDrawableRes: Int = R.drawable.ic_close,
) {
Row(
Box(
modifier = modifier,
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
) {
if (showLeftButton) {
Icon(
modifier = Modifier
.size(20.dp)
.clickable { onClickLeftButton() },
painter = painterResource(leftButtonDrawableRes),
contentDescription = stringResource(leftButtonDescriptionRes),
tint = WappTheme.colors.white,
modifier = Modifier
.size(20.dp)
.clickable { onClickLeftButton() }
.align(Alignment.CenterStart),
)
}

Text(
text = stringResource(titleRes),
textAlign = TextAlign.Center,
modifier = Modifier.weight(1f),
style = WappTheme.typography.titleBold,
color = WappTheme.colors.white,
modifier = Modifier.align(Alignment.Center),
)

if (showRightButton) {
Icon(
modifier = Modifier
.size(20.dp)
.clickable { onClickRightButton() },
painter = painterResource(rightButtonDrawableRes),
contentDescription = stringResource(rightButtonDescriptionRes),
tint = WappTheme.colors.white,
modifier = Modifier
.size(20.dp)
.clickable { onClickRightButton() }
.align(Alignment.CenterEnd),
)
}
}
Expand Down

0 comments on commit 8dd3bb6

Please sign in to comment.