package com.aiosman.riderpro.ui.composables

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.wrapContentWidth
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.res.stringResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.aiosman.riderpro.R
import com.aiosman.riderpro.ui.modifiers.noRippleClickable

@Composable
fun FollowButton(
    isFollowing: Boolean,
    fontSize: TextUnit = 12.sp,
    imageModifier: Modifier = Modifier,
    onFollowClick: () -> Unit,
){
    Box(
        modifier = Modifier
            .wrapContentWidth()
            .padding(start = 6.dp)
            .noRippleClickable {
                onFollowClick()
            },
        contentAlignment = Alignment.Center
    ) {
        Image(
            modifier = imageModifier,
            painter = painterResource(id = R.drawable.follow_bg),
            contentDescription = "",
            contentScale = ContentScale.FillWidth
        )
        Text(
            text = if (isFollowing) stringResource(R.string.following_upper) else stringResource(
                R.string.follow_upper
            ),
            fontSize = fontSize,
            color = Color.White,
            style = TextStyle(fontWeight = FontWeight.Bold)
        )
    }
}