package com.aiosman.riderpro.ui.composables

import androidx.annotation.DrawableRes
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp
import com.aiosman.riderpro.ui.modifiers.noRippleClickable

@Composable
fun ActionButton(
    modifier: Modifier,
    text: String,
    color: Color = Color.White,
    @DrawableRes backgroundImage: Int,
    leading: @Composable (() -> Unit)? = null,
    click: () -> Unit = {}
) {
    Box(
        modifier = modifier.noRippleClickable {
            click()
        }
    ) {
        Image(
            painter = painterResource(id = backgroundImage),
            contentDescription = "Rider Pro",
            modifier = Modifier.fillMaxSize(),
            contentScale = ContentScale.FillBounds
        )
        Row(
            modifier = Modifier.align(Alignment.Center),
            verticalAlignment = Alignment.CenterVertically
        ) {
            leading?.invoke()
            Text(text, fontSize = 14.sp, color = color, fontWeight = FontWeight.W600, fontStyle = FontStyle.Italic)
        }

    }
}