now takes viewmodel and open function. Also uses viewmodel functions
This commit is contained in:
parent
71a42a28e2
commit
f5940e4743
1 changed files with 15 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
|||
package be.ugent.sel.studeez.common.composable
|
||||
package be.ugent.sel.studeez.screens.navbar
|
||||
|
||||
import androidx.compose.material.BottomNavigation
|
||||
import androidx.compose.material.BottomNavigationItem
|
||||
|
@ -12,10 +12,14 @@ import androidx.compose.material.icons.outlined.DateRange
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import be.ugent.sel.studeez.ui.theme.StudeezTheme
|
||||
|
||||
@Composable
|
||||
fun NavigationBar() {
|
||||
fun NavigationBar(
|
||||
popUpAndOpen: (String, String) -> Unit,
|
||||
viewModel: NavigationBarViewModel = hiltViewModel()
|
||||
) {
|
||||
// TODO Pass functions and new screens.
|
||||
// TODO Pass which screen is selected.
|
||||
// TODO Disabled -> HIGH/MEDIUM_EMPHASIS if the page is implemented
|
||||
|
@ -26,14 +30,14 @@ fun NavigationBar() {
|
|||
icon = { Icon(imageVector = Icons.Default.List, "Home") },
|
||||
label = { Text(text = "Home") },
|
||||
selected = false, // TODO
|
||||
onClick = { /* TODO */ }
|
||||
onClick = { viewModel.onHomeClick(popUpAndOpen) }
|
||||
)
|
||||
|
||||
BottomNavigationItem(
|
||||
icon = { Icon(imageVector = Icons.Default.Check, "Tasks") },
|
||||
label = { Text(text = "Tasks") },
|
||||
selected = false, // TODO
|
||||
onClick = { /* TODO */ }
|
||||
onClick = { viewModel.onTasksClick(popUpAndOpen) }
|
||||
)
|
||||
|
||||
// Hack to space the entries in the navigation bar, make space for fab
|
||||
|
@ -43,21 +47,21 @@ fun NavigationBar() {
|
|||
icon = { Icon(imageVector = Icons.Outlined.DateRange, "Sessions") },
|
||||
label = { Text(text = "Sessions") },
|
||||
selected = false, // TODO
|
||||
onClick = { /* TODO */ }
|
||||
onClick = { viewModel.onSessionsClick(popUpAndOpen) }
|
||||
)
|
||||
|
||||
BottomNavigationItem(
|
||||
icon = { Icon(imageVector = Icons.Default.Person, "Profile") },
|
||||
label = { Text(text = "Profile") },
|
||||
selected = false, // TODO
|
||||
onClick = { /* TODO */ }
|
||||
onClick = { viewModel.onProfileClick(popUpAndOpen) }
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun NavigationBarPreview() {
|
||||
StudeezTheme { NavigationBar() }
|
||||
}
|
||||
//@Preview(showBackground = true)
|
||||
//@Composable
|
||||
//fun NavigationBarPreview() {
|
||||
// StudeezTheme { NavigationBar() }
|
||||
//}
|
Reference in a new issue