Skip to content

Commit 9b69980

Browse files
committed
[NDGL-65] NDGLNavigationBar의 Trailing 아이콘이 없을 때 타이틀이 중앙에 정렬되지 않는 이슈 수정
1 parent 49d8a90 commit 9b69980

File tree

1 file changed

+40
-7
lines changed

1 file changed

+40
-7
lines changed

core/ui/src/main/java/com/yapp/ndgl/core/ui/designsystem/NDGLNavigationBar.kt

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.yapp.ndgl.core.ui.designsystem
33
import androidx.annotation.DrawableRes
44
import androidx.compose.foundation.clickable
55
import androidx.compose.foundation.layout.Arrangement
6+
import androidx.compose.foundation.layout.Box
67
import androidx.compose.foundation.layout.Row
78
import androidx.compose.foundation.layout.RowScope
89
import androidx.compose.foundation.layout.Spacer
@@ -45,8 +46,8 @@ fun NDGLNavigationBar(
4546
modifier = modifier
4647
.fillMaxWidth()
4748
.height(48.dp)
48-
.padding(horizontal = 24.dp, vertical = 12.dp),
49-
horizontalArrangement = Arrangement.spacedBy(8.dp),
49+
.padding(horizontal = 24.dp, vertical = 4.dp),
50+
horizontalArrangement = Arrangement.spacedBy(4.dp),
5051
verticalAlignment = Alignment.CenterVertically,
5152
) {
5253
leadingIcon?.let { icon ->
@@ -69,8 +70,10 @@ fun NDGLNavigationBar(
6970
)
7071
} ?: Spacer(modifier = Modifier.weight(1f))
7172

72-
trailingContents?.let { contents ->
73-
contents()
73+
if (trailingContents != null) {
74+
trailingContents()
75+
} else {
76+
Box(modifier = Modifier.size(40.dp))
7477
}
7578
}
7679
}
@@ -84,10 +87,10 @@ fun NDGLNavigationIcon(
8487
imageVector = ImageVector.vectorResource(icon),
8588
contentDescription = null,
8689
modifier = Modifier
87-
.size(28.dp)
8890
.clip(CircleShape)
89-
.clickable(onClick = onClick),
90-
tint = NDGLTheme.colors.black700,
91+
.clickable(onClick = onClick)
92+
.padding(6.dp),
93+
tint = NDGLTheme.colors.black600,
9194
)
9295
}
9396

@@ -113,6 +116,36 @@ private fun NDGLNavigationBarCenterPreview() {
113116
}
114117
}
115118

119+
@Preview(showBackground = true)
120+
@Composable
121+
private fun NDGLNavigationBarPreview() {
122+
NDGLTheme {
123+
NDGLNavigationBar(
124+
textAlignType = NDGLNavigationBarAttr.TextAlignType.CENTER,
125+
headline = "미리보기",
126+
leadingIcon = R.drawable.ic_28_chevron_left,
127+
trailingContents = {
128+
NDGLNavigationIcon(
129+
icon = R.drawable.ic_28_search,
130+
onClick = {},
131+
)
132+
},
133+
)
134+
}
135+
}
136+
137+
@Preview(showBackground = true)
138+
@Composable
139+
private fun NDGLNavigationBarNoTrailingPreview() {
140+
NDGLTheme {
141+
NDGLNavigationBar(
142+
textAlignType = NDGLNavigationBarAttr.TextAlignType.CENTER,
143+
headline = "미리보기",
144+
leadingIcon = R.drawable.ic_28_chevron_left,
145+
)
146+
}
147+
}
148+
116149
@Preview(showBackground = true)
117150
@Composable
118151
private fun NDGLNavigationBarStartPreview() {

0 commit comments

Comments
 (0)