package main.component

import androidx.compose.foundation.layout.width
import androidx.compose.material.Button
import androidx.compose.material.ButtonDefaults
import androidx.compose.material.Text
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.material.Icon
import androidx.compose.ui.graphics.vector.ImageVector
import main.customRedColor

@Composable
fun buttonComponent(
    text: String,
    onClick: () -> Unit,
    modifier: Modifier = Modifier,
    icon: ImageVector? = null,
    width: Int = 200

) {
    Button(
        onClick = onClick,
        modifier = modifier.width(width.dp),
        colors = ButtonDefaults.buttonColors(
            backgroundColor = customRedColor,
            contentColor = Color.White
        )
    ) {
        if (icon != null) {
            Icon(imageVector = icon, contentDescription = null)
        }
        Text(text)
    }
}