package com.aiosman.ravenow.ui.composables

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentWidth
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.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.aiosman.ravenow.LocalAppTheme
import com.aiosman.ravenow.R
import com.aiosman.ravenow.ui.modifiers.noRippleClickable

@Composable
fun FollowButton(
    isFollowing: Boolean,
    fontSize: TextUnit = 14.sp,
    onFollowClick: () -> Unit,
){
    val AppColors = LocalAppTheme.current
    Box(
        modifier = Modifier
            .wrapContentWidth()
            .clip(RoundedCornerShape(8.dp))
            .background(
                color = if (isFollowing) AppColors.nonActive else AppColors.nonActive
            )
            .padding(horizontal = 16.dp, vertical = 8.dp)
            .noRippleClickable {
                onFollowClick()
            },
        contentAlignment = Alignment.Center
    ) {
        Text(
            text = if (isFollowing) stringResource(R.string.follow_upper_had) else stringResource(R.string.follow_upper),
            fontSize = fontSize,
            color = if (isFollowing) AppColors.text else AppColors.text,
            style = TextStyle(fontWeight = FontWeight.Bold)
        )
    }
}