package com.example.labwork.button_navigation

import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.BottomNavigation
import androidx.compose.material.BottomNavigationItem
import androidx.compose.material.Icon
import androidx.compose.material.SnackbarDefaults.backgroundColor
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavController
import androidx.navigation.compose.currentBackStackEntryAsState
import com.example.labwork.ui.theme.DarkBluePolitech
import com.example.labwork.ui.theme.LightBluePolitech


@Composable
fun SlideNavigation(
    navController: NavController
) {
    val listItems = listOf(
        SlideItem.ScreenInfo,
        SlideItem.ScreenProfile,
        SlideItem.ScreenListProduct
    )

    BottomNavigation(
        backgroundColor = Color.White,
        modifier = Modifier.padding(10.dp),
        elevation =  5.dp

    ) {
        val backStackEntry by navController.currentBackStackEntryAsState()
        val currentRout = backStackEntry?.destination?.route
        listItems.forEach { item ->
            BottomNavigationItem(
                selected = currentRout == item.route,
                onClick = {
                          navController.navigate(item.route)
                          },
                icon = {
                    Icon(
                        painter = painterResource(id = item.iconId),
                        contentDescription = "Icon"
                    )
                },
                label = {
                    Text(
                        text = item.title,
                        fontSize = 9.sp
                    )
                },
                selectedContentColor = LightBluePolitech,
                unselectedContentColor = DarkBluePolitech
            )
        }
    }
}