Skip to content

Commit 074c754

Browse files
committed
Chore: 바텀네이게이션 바 변경된 icon 적용
1 parent f5b88a6 commit 074c754

3 files changed

Lines changed: 27 additions & 32 deletions

File tree

app/src/main/java/com/threegap/bitnagil/navigation/home/HomeBottomNavigationBar.kt

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.threegap.bitnagil.navigation.home
22

3-
import androidx.compose.foundation.Image
43
import androidx.compose.foundation.background
54
import androidx.compose.foundation.clickable
65
import androidx.compose.foundation.interaction.MutableInteractionSource
@@ -9,6 +8,7 @@ import androidx.compose.foundation.layout.Arrangement
98
import androidx.compose.foundation.layout.Column
109
import androidx.compose.foundation.layout.Row
1110
import androidx.compose.foundation.layout.fillMaxWidth
11+
import androidx.compose.foundation.layout.height
1212
import androidx.compose.foundation.layout.padding
1313
import androidx.compose.foundation.layout.size
1414
import androidx.compose.material3.Text
@@ -17,13 +17,12 @@ import androidx.compose.runtime.getValue
1717
import androidx.compose.runtime.remember
1818
import androidx.compose.ui.Alignment
1919
import androidx.compose.ui.Modifier
20-
import androidx.compose.ui.graphics.ColorFilter
21-
import androidx.compose.ui.res.painterResource
2220
import androidx.compose.ui.tooling.preview.Preview
2321
import androidx.compose.ui.unit.dp
2422
import androidx.navigation.NavController
2523
import androidx.navigation.compose.currentBackStackEntryAsState
2624
import com.threegap.bitnagil.designsystem.BitnagilTheme
25+
import com.threegap.bitnagil.designsystem.component.atom.BitnagilIcon
2726

2827
@Composable
2928
fun HomeBottomNavigationBar(
@@ -35,14 +34,15 @@ fun HomeBottomNavigationBar(
3534
modifier = Modifier
3635
.fillMaxWidth()
3736
.background(color = BitnagilTheme.colors.white)
37+
.height(62.dp)
3838
.padding(horizontal = 16.dp, vertical = 7.dp),
39-
horizontalArrangement = Arrangement.spacedBy(12.dp),
39+
horizontalArrangement = Arrangement.spacedBy(10.dp),
40+
verticalAlignment = Alignment.CenterVertically,
4041
) {
4142
HomeRoute.entries.map { homeRoute ->
4243
HomeBottomNavigationItem(
4344
modifier = Modifier.weight(1f),
44-
selectIconResourceId = homeRoute.selectIconResourceId,
45-
unSelectIconResourceId = homeRoute.unSelectIconResourceId,
45+
icon = homeRoute.icon,
4646
title = homeRoute.title,
4747
onClick = {
4848
navController.navigate(homeRoute.route) {
@@ -58,8 +58,7 @@ fun HomeBottomNavigationBar(
5858
@Composable
5959
private fun HomeBottomNavigationItem(
6060
modifier: Modifier = Modifier,
61-
selectIconResourceId: Int,
62-
unSelectIconResourceId: Int,
61+
icon: Int,
6362
title: String,
6463
onClick: () -> Unit,
6564
selected: Boolean,
@@ -68,25 +67,26 @@ private fun HomeBottomNavigationItem(
6867
val isPressed by interactionSource.collectIsPressedAsState()
6968

7069
val contentTintColor = when {
71-
isPressed -> BitnagilTheme.colors.navy300
72-
selected -> BitnagilTheme.colors.navy500
73-
else -> BitnagilTheme.colors.navy100
70+
isPressed -> BitnagilTheme.colors.coolGray10
71+
selected -> BitnagilTheme.colors.coolGray10
72+
else -> BitnagilTheme.colors.coolGray90
7473
}
75-
val iconResourceId = if (selected) selectIconResourceId else unSelectIconResourceId
7674

7775
Column(
78-
modifier = modifier.clickable(
79-
onClick = onClick,
80-
interactionSource = interactionSource,
81-
indication = null,
82-
),
76+
modifier = modifier
77+
.clickable(
78+
onClick = onClick,
79+
interactionSource = interactionSource,
80+
indication = null,
81+
)
82+
.padding(4.dp),
8383
horizontalAlignment = Alignment.CenterHorizontally,
84+
verticalArrangement = Arrangement.spacedBy(4.dp),
8485
) {
85-
Image(
86-
painter = painterResource(id = iconResourceId),
87-
contentDescription = title,
88-
modifier = Modifier.padding(4.dp).size(24.dp),
89-
colorFilter = ColorFilter.tint(color = contentTintColor),
86+
BitnagilIcon(
87+
id = icon,
88+
modifier = Modifier.size(24.dp),
89+
tint = contentTintColor,
9090
)
9191

9292
Text(
@@ -104,6 +104,5 @@ private fun HomeBottomNavigationBarPreview() {
104104

105105
HomeBottomNavigationBar(
106106
navController = navigator.navController,
107-
108107
)
109108
}

app/src/main/java/com/threegap/bitnagil/navigation/home/HomeNavHost.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ fun HomeNavHost(
108108
onClick = { GlobalBitnagilToast.showWarning("제보하기 기능은 추후 제공될 예정입니다.") },
109109
),
110110
FloatingActionItem(
111-
icon = R.drawable.ic_add_routine,
111+
icon = R.drawable.ic_routine_add,
112112
text = "루틴 등록",
113113
onClick = { navigateToRegisterRoutine(null) },
114114
),

app/src/main/java/com/threegap/bitnagil/navigation/home/HomeRoute.kt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,24 @@ import com.threegap.bitnagil.R
55
enum class HomeRoute(
66
val route: String,
77
val title: String,
8-
val selectIconResourceId: Int,
9-
val unSelectIconResourceId: Int,
8+
val icon: Int,
109
) {
1110
Home(
1211
route = "home/home",
1312
title = "",
14-
selectIconResourceId = R.drawable.ic_home_fill,
15-
unSelectIconResourceId = R.drawable.ic_home_empty,
13+
icon = R.drawable.ic_home,
1614
),
1715

1816
RecommendRoutine(
1917
route = "home/recommend_routine",
2018
title = "추천 루틴",
21-
selectIconResourceId = R.drawable.ic_recommend_fill,
22-
unSelectIconResourceId = R.drawable.ic_recommend_empty,
19+
icon = R.drawable.ic_routine_recommend,
2320
),
2421

2522
MyPage(
2623
route = "home/my_page",
2724
title = "마이페이지",
28-
selectIconResourceId = R.drawable.ic_mypage_fill,
29-
unSelectIconResourceId = R.drawable.ic_mypage_empty,
25+
icon = R.drawable.ic_profile,
3026
),
3127
;
3228
}

0 commit comments

Comments
 (0)