Skip to content

Commit

Permalink
refactor: leftIcon 없을 경우 고려
Browse files Browse the repository at this point in the history
  • Loading branch information
syb8200 committed Jan 1, 2024
1 parent 6b5f070 commit 43793ca
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import com.susu.core.ui.extension.susuClickable
@Composable
fun SusuDefaultAppBar(
modifier: Modifier = Modifier,
leftIcon: @Composable () -> Unit,
leftIcon: @Composable () -> Unit = {},
title: String? = null,
actions: @Composable () -> Unit = {},
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
Expand All @@ -28,8 +27,8 @@ import com.susu.core.ui.extension.susuClickable
@Composable
fun SusuProgressAppBar(
modifier: Modifier = Modifier,
@DrawableRes leftIcon: Int = R.drawable.ic_arrow_left,
leftIconContentDescription: String = stringResource(R.string.app_bar_back_button),
@DrawableRes leftIcon: Int? = null,
leftIconContentDescription: String? = null,
leftIconPadding: Dp = SusuTheme.spacing.spacing_xs,
currentStep: Int,
entireStep: Int,
Expand All @@ -39,16 +38,18 @@ fun SusuProgressAppBar(
BasicAppBar(
modifier = modifier,
leftIcon = {
Icon(
painter = painterResource(id = leftIcon),
contentDescription = leftIconContentDescription,
modifier = Modifier
.susuClickable(
rippleEnabled = true,
onClick = onClickBackButton,
)
.padding(leftIconPadding),
)
leftIcon?.let {
Icon(
painter = painterResource(id = leftIcon),
contentDescription = leftIconContentDescription,
modifier = Modifier
.susuClickable(
rippleEnabled = true,
onClick = onClickBackButton,
)
.padding(leftIconPadding),
)
}
},
title = {
LinearProgressIndicator(
Expand Down Expand Up @@ -77,6 +78,8 @@ fun SusuProgressAppBarPreview() {
verticalArrangement = Arrangement.spacedBy(20.dp),
) {
SusuProgressAppBar(
leftIcon = R.drawable.ic_arrow_left,
leftIconContentDescription = "뒤로가기",
currentStep = currentStep,
entireStep = entireStep,
onClickBackButton = {
Expand Down
4 changes: 0 additions & 4 deletions core/designsystem/src/main/res/values/strings.xml

This file was deleted.

0 comments on commit 43793ca

Please sign in to comment.