Skip to content

Commit

Permalink
Update bottom nav and nav rail string resources
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorKabata committed Aug 24, 2024
1 parent 7c919a6 commit 6af5f91
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import androidx.navigation.NavHostController
import androidx.navigation.compose.currentBackStackEntryAsState
import com.vickbt.shared.ui.navigation.NavigationItem
import com.vickbt.shared.ui.theme.Gray
import org.jetbrains.compose.resources.stringResource

@Composable
fun BottomNavBar(
Expand All @@ -35,11 +36,16 @@ fun BottomNavBar(
item.icon?.let {
Icon(
imageVector = item.icon,
contentDescription = item.title
contentDescription = stringResource(item.title)
)
}
},
label = { Text(text = item.title, style = MaterialTheme.typography.labelSmall) },
label = {
Text(
text = stringResource(item.title),
style = MaterialTheme.typography.labelSmall
)
},
alwaysShowLabel = true,
colors = NavigationBarItemDefaults.colors(
selectedIconColor = MaterialTheme.colorScheme.primary,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import androidx.navigation.compose.currentBackStackEntryAsState
import com.vickbt.shared.ui.navigation.NavigationItem
import com.vickbt.shared.ui.theme.Gray
import com.vickbt.shared.ui.theme.PrimaryColor
import org.jetbrains.compose.resources.stringResource

@Composable
fun NavRailBar(
Expand All @@ -38,11 +39,16 @@ fun NavRailBar(
item.icon?.let {
Icon(
imageVector = it,
contentDescription = item.title
contentDescription = stringResource(item.title)
)
}
},
label = { Text(text = item.title, style = MaterialTheme.typography.labelSmall) },
label = {
Text(
text = stringResource(item.title),
style = MaterialTheme.typography.labelSmall
)
},
colors = NavigationRailItemDefaults.colors(
selectedIconColor = PrimaryColor,
unselectedIconColor = Gray
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,30 @@ package com.vickbt.shared.ui.navigation
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.Favorite
import androidx.compose.material.icons.rounded.Home
import androidx.compose.material.icons.rounded.Search
import androidx.compose.material.icons.rounded.Settings
import androidx.compose.ui.graphics.vector.ImageVector
import notflix.shared.generated.resources.Res
import notflix.shared.generated.resources.title_details
import notflix.shared.generated.resources.title_favorites
import notflix.shared.generated.resources.title_home
import notflix.shared.generated.resources.title_search
import notflix.shared.generated.resources.title_settings
import org.jetbrains.compose.resources.StringResource

sealed class NavigationItem(
val route: String,
val title: String,
val title: StringResource,
val icon: ImageVector?
) {

object Home : NavigationItem("/home", "Home", Icons.Rounded.Home)
object Favorites : NavigationItem("/favorites", "Favorites", Icons.Rounded.Favorite)
object Settings : NavigationItem("/settings", "Settings", Icons.Rounded.Settings)
object Details : NavigationItem("/details/{movieId}", "Details", null)
object Home : NavigationItem("/home", Res.string.title_home, Icons.Rounded.Home)
object Favorites :
NavigationItem("/favorites", Res.string.title_favorites, Icons.Rounded.Favorite)

object Search :
NavigationItem("/search", Res.string.title_search, Icons.Rounded.Search)

object Settings : NavigationItem("/settings", Res.string.title_settings, Icons.Rounded.Settings)
object Details : NavigationItem("/details/{movieId}", Res.string.title_details, null)
}

0 comments on commit 6af5f91

Please sign in to comment.