package com.za.base.view

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
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.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.za.base.theme.buttonBgColor
import com.za.base.theme.headBgColor
import com.za.ext.noDoubleClick

@Composable
fun CommonButton(text: String, onClick: () -> Unit) {
    Box(modifier = Modifier
        .fillMaxWidth()
        .noDoubleClick { onClick() }
        .padding(horizontal = 60.dp, vertical = 10.dp)
        .background(color = buttonBgColor, shape = RoundedCornerShape(4.dp))
        .padding(vertical = 12.dp), contentAlignment = Alignment.Center) {
        Text(text = text, color = Color.White,
            fontSize = 15.sp,
            fontWeight = FontWeight.Medium)
    }
}