package com.pmdm.navegacion.ui.composables

import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBarScrollBehavior
import androidx.compose.runtime.Composable
import androidx.compose.ui.text.style.TextOverflow
import com.github.pmdmiesbalmis.components.ui.icons.Filled

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun TopAppBarEjemplo(
    comportamientoAnteScroll: TopAppBarScrollBehavior,
    onNavegarAtras: (() -> Unit)? = null
) = TopAppBar(
    title = {
        Text("Compartiendo datos con VM", maxLines = 1, overflow = TextOverflow.Ellipsis)
    },
    navigationIcon = {
        if (onNavegarAtras != null)
            IconButton(onClick = onNavegarAtras) {
                Icon(painter = Filled.getArrowBackIosIcon(), contentDescription = null)
            }
    },
    scrollBehavior = comportamientoAnteScroll
)

