Skip to content

Commit af5d0d1

Browse files
committed
[BOOK-45] refactor: 하드 코딩된 MainTab 문자열 string resource 추출
1 parent e3685f0 commit af5d0d1

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

feature/main/src/main/kotlin/com/ninecraft/booket/feature/main/component/MainBottomBar.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import androidx.compose.ui.Alignment
2727
import androidx.compose.ui.Modifier
2828
import androidx.compose.ui.graphics.Color
2929
import androidx.compose.ui.graphics.vector.ImageVector
30+
import androidx.compose.ui.res.stringResource
3031
import androidx.compose.ui.res.vectorResource
3132
import androidx.compose.ui.text.font.FontWeight
3233
import androidx.compose.ui.unit.IntOffset
@@ -135,7 +136,7 @@ private fun RowScope.MainBottomBarItem(
135136
)
136137
Spacer(modifier = Modifier.height(5.dp))
137138
Text(
138-
text = tab.label,
139+
text = stringResource(tab.labelResId),
139140
color = if (selected) Color(0xFF1F1F1F) else Color(0xFF9E9E9E),
140141
fontWeight = if (selected) FontWeight.SemiBold else FontWeight.Normal,
141142
)
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.ninecraft.booket.feature.main.component
22

33
import androidx.annotation.DrawableRes
4+
import androidx.annotation.StringRes
45
import com.ninecraft.booket.feature.home.HomeScreen
56
import com.ninecraft.booket.feature.library.LibraryScreen
67
import com.ninecraft.booket.feature.main.R
@@ -10,29 +11,29 @@ import com.slack.circuit.runtime.screen.Screen
1011
internal enum class MainTab(
1112
@DrawableRes val iconResId: Int,
1213
@DrawableRes val selectedIconResId: Int,
14+
@StringRes val labelResId: Int,
1315
internal val contentDescription: String,
14-
val label: String,
1516
val screen: Screen,
1617
) {
1718
HOME(
1819
iconResId = R.drawable.ic_home,
1920
selectedIconResId = R.drawable.ic_selected_home,
21+
labelResId = R.string.home_label,
2022
contentDescription = "Home Icon",
21-
label = "",
2223
screen = HomeScreen,
2324
),
2425
SEARCH(
2526
iconResId = R.drawable.ic_search,
2627
selectedIconResId = R.drawable.ic_selected_search,
28+
labelResId = R.string.search_label,
2729
contentDescription = "Search Icon",
28-
label = "도서 검색",
2930
screen = SearchScreen,
3031
),
3132
LIBRARY(
3233
iconResId = R.drawable.ic_library,
3334
selectedIconResId = R.drawable.ic_selected_library,
35+
labelResId = R.string.library_label,
3436
contentDescription = "Library Icon",
35-
label = "내 서재",
3637
screen = LibraryScreen,
3738
),
3839
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<resources>
2+
<string name="home_label">홈</string>
3+
<string name="search_label">도서 검색</string>
4+
<string name="library_label">내 서재</string>
5+
</resources>

0 commit comments

Comments
 (0)