Skip to content

Commit e477480

Browse files
committed
[NDGL-65] fix: NDGLNavigationBar의 Trailing 아이콘이 없을 때 타이틀이 중앙에 정렬되지 않는 이슈 수정
1 parent 6a0aa68 commit e477480

File tree

1 file changed

+41
-7
lines changed

1 file changed

+41
-7
lines changed

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

Lines changed: 41 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,11 @@ fun NDGLNavigationIcon(
8487
imageVector = ImageVector.vectorResource(icon),
8588
contentDescription = null,
8689
modifier = Modifier
87-
.size(28.dp)
90+
.size(40.dp)
8891
.clip(CircleShape)
89-
.clickable(onClick = onClick),
90-
tint = NDGLTheme.colors.black700,
92+
.clickable(onClick = onClick)
93+
.padding(6.dp),
94+
tint = NDGLTheme.colors.black600,
9195
)
9296
}
9397

@@ -113,6 +117,36 @@ private fun NDGLNavigationBarCenterPreview() {
113117
}
114118
}
115119

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

0 commit comments

Comments
 (0)