Skip to content

Commit

Permalink
[YDS-#248] Improve : SingleTopBar, DoubleTopBar 네비게이션 아이콘 넣을 수 있게 (#249)
Browse files Browse the repository at this point in the history
* add : 싱글타이틀 바에 네비게이션 아이콘 추가

* add : 더블타이틀바에 네비게이션 아이콘 추가

* chore : 후행 쉼표 추가

* chore : 탑바버튼들 중 isDisabled있는거 제거, 기본값이기 때문

* 버전업
  • Loading branch information
Gael-Android authored Feb 5, 2024
1 parent 321b3b9 commit bedb41c
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,12 @@ private fun PreviewTopBarButton() {
onClick()
},
icon = R.drawable.ic_ground_filled,
isDisabled = false,
)
TopBarButton(
onClick = {
onClick()
},
icon = R.drawable.ic_ground_filled,
isDisabled = true,
)
}
Column(
Expand All @@ -113,14 +111,12 @@ private fun PreviewTopBarButton() {
onClick()
},
text = "닫기",
isDisabled = false,
)
TopBarButton(
onClick = {
onClick()
},
text = "닫기",
isDisabled = true,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,14 @@ private fun YdsScaffoldPreview() {
navigationIcon = {
TopBarButton(
icon = R.drawable.ic_arrow_left_line,
isDisabled = false,
)
},
actions = {
TopBarButton(
icon = R.drawable.ic_bell_line,
isDisabled = false,
)
TopBarButton(
icon = R.drawable.ic_search_line,
isDisabled = false,
onClick = {
scope.launch {
toastHostState.showToast(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,17 +320,14 @@ private fun PreviewNavigation() {
navigationIcon = {
TopBarButton(
icon = R.drawable.ic_arrow_left_line,
isDisabled = false,
)
},
actions = {
TopBarButton(
icon = R.drawable.ic_bell_line,
isDisabled = false,
)
TopBarButton(
icon = R.drawable.ic_search_line,
isDisabled = false,
onClick = { },
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,43 +24,47 @@ fun DoubleTitleTopBar(
modifier: Modifier = Modifier,
title: String = "",
subtitle: String = "",
navigationIcon: @Composable () -> Unit = {},
actions: @Composable RowScope.() -> Unit = {},
) {
TopAppBar(
modifier = modifier
.fillMaxWidth()
.height(72.dp),
contentPadding = PaddingValues(end = 4.dp)
contentPadding = PaddingValues(end = 4.dp),
) {
Box(
modifier = Modifier.fillMaxWidth()
modifier = Modifier.fillMaxWidth(),
) {

Column(
modifier = Modifier.padding(
start = 16.dp,
top = 12.dp,
end = 16.dp,
bottom = 8.dp
)
) {
YdsText(
text = subtitle,
style = YdsTheme.typography.body2,
color = YdsTheme.colors.textPrimary
)
YdsText(
text = title,
style = YdsTheme.typography.title2,
color = YdsTheme.colors.textPrimary
)
Row {
navigationIcon()
Column(
modifier = Modifier.padding(
start = 16.dp,
top = 12.dp,
end = 16.dp,
bottom = 8.dp,
)
) {
YdsText(
text = subtitle,
style = YdsTheme.typography.body2,
color = YdsTheme.colors.textPrimary,
)
YdsText(
text = title,
style = YdsTheme.typography.title2,
color = YdsTheme.colors.textPrimary,
)
}
}

Row(
modifier = Modifier
.padding(top = 16.dp)
.align(Alignment.BottomEnd),
verticalAlignment = Alignment.CenterVertically
verticalAlignment = Alignment.CenterVertically,
) {
actions()
}
Expand All @@ -77,20 +81,22 @@ private fun PreviewDoubleTitleTopBar() {
DoubleTitleTopBar(
title = "타이틀",
subtitle = "서브타이틀",
navigationIcon = {
TopBarButton(
icon = R.drawable.ic_arrow_left_line,
)
},
actions = {
TopBarButton(
icon = R.drawable.ic_ground_filled,
isDisabled = false
)
TopBarButton(
icon = R.drawable.ic_ground_filled,
isDisabled = false
)
TopBarButton(
icon = R.drawable.ic_ground_filled,
isDisabled = false
)
}
},
)
}
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ private fun PreviewSearchTopBar() {
navigationIcon = {
TopBarButton(
icon = R.drawable.ic_arrow_left_line,
isDisabled = false,
onClick = {
Toast.makeText(
context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,37 @@ import com.yourssu.design.system.compose.base.YdsText
fun SingleTitleTopBar(
modifier: Modifier = Modifier,
title: String = "",
navigationIcon: @Composable () -> Unit = {},
actions: @Composable RowScope.() -> Unit = {},
) {
TopAppBar(
modifier = modifier
.fillMaxWidth()
.height(56.dp),
contentPadding = PaddingValues(end = 4.dp)
contentPadding = PaddingValues(end = 4.dp),
) {
Box(
modifier = Modifier
.fillMaxWidth()
.fillMaxWidth(),
) {
YdsText(
modifier = Modifier
.padding(16.dp, 17.dp, 16.dp, 8.dp)
.wrapContentHeight(),
text = title,
style = YdsTheme.typography.title2,
color = YdsTheme.colors.textPrimary
)
Row {
navigationIcon()
YdsText(
modifier = Modifier
.padding(16.dp, 17.dp, 16.dp, 8.dp)
.wrapContentHeight(),
text = title,
style = YdsTheme.typography.title2,
color = YdsTheme.colors.textPrimary,
)
}

Row(
modifier = Modifier
.fillMaxHeight()
.padding(0.dp)
.align(Alignment.TopEnd),
verticalAlignment = Alignment.CenterVertically
verticalAlignment = Alignment.CenterVertically,
) {
actions()
}
Expand All @@ -66,20 +70,22 @@ private fun PreviewSingleTitleTopBar() {
topBar = {
SingleTitleTopBar(
title = "타이틀",
navigationIcon = {
TopBarButton(
icon = R.drawable.ic_arrow_left_line,
)
},
actions = {
TopBarButton(
icon = R.drawable.ic_ground_filled,
isDisabled = false
)
TopBarButton(
icon = R.drawable.ic_ground_filled,
isDisabled = false
)
TopBarButton(
icon = R.drawable.ic_ground_filled,
isDisabled = false
)
}
},
)
}
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,14 @@ private fun PreviewTopBar() {
navigationIcon = {
TopBarButton(
icon = R.drawable.ic_arrow_left_line,
isDisabled = false,
)
},
actions = {
TopBarButton(
icon = R.drawable.ic_bell_line,
isDisabled = false,
)
TopBarButton(
icon = R.drawable.ic_search_line,
isDisabled = false,
)
}
)
Expand Down
2 changes: 1 addition & 1 deletion version.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
versionName=2.5.2
versionName=2.5.3
#자동 배포를 위해서 버전은 여기 한 군데에서 관리하면 된다

0 comments on commit bedb41c

Please sign in to comment.