package mg.dot.feufaro

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.List
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material.icons.filled.Edit
import androidx.compose.material.icons.filled.List
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.compose.material3.IconButton
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.ui.unit.TextUnitType
@Composable
fun ContextualMenu (onMenuItemClick: (String) -> Unit){
    Column(
        modifier = Modifier
            .background(Color.DarkGray.copy(alpha = 0.8f), RoundedCornerShape(8.dp))
            .padding(8.dp)
    ) {
        MenuItem(icon = Icons.Default.Add, text = "+") { onMenuItemClick("Ajouter")}
        MenuItem(icon = Icons.Default.Edit, text = "!") { onMenuItemClick("Modifier")}
        MenuItem(icon = Icons.AutoMirrored.Filled.List, text = "-") { onMenuItemClick("Liste")}
    }
}

@Composable
fun MenuItem(icon: androidx.compose.ui.graphics.vector.ImageVector, text: String, onClick: () -> Unit) {
    IconButton(onClick = onClick) {
        Column(horizontalAlignment = androidx.compose.ui.Alignment.CenterHorizontally) {
            Icon(icon, contentDescription = text, tint = Color.White)
        }
    }
}