package com.zaojiao.app.feat.home.personal

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.zaojiao.component.common.Colors
import com.zaojiao.component.common.Spacer


@Composable
fun HomePersonalEngage() {
    Row(
        modifier = Modifier
            .padding(bottom = 6.dp)
            .padding(vertical = 5.dp, horizontal = 8.dp)
            .fillMaxWidth(),
        horizontalArrangement = Arrangement.SpaceAround,
    ) {
        HomePersonalEngageItem(num = 20, title = "关注")
        HomePersonalEngageItem(num = 200, title = "粉丝")
        HomePersonalEngageItem(num = 2999, title = "获赞")
        HomePersonalEngageItem(num = 2848180, title = "收藏")
    }
}

@Composable
fun RowScope.HomePersonalEngageItem(
    num: Int = 0,
    title: String,
) {
    Column(
        modifier = Modifier.weight(1f),
        horizontalAlignment = Alignment.CenterHorizontally,
    ) {
        Text(
            text = if (num > 999) "999+" else num.toString(),
            style = TextStyle(
                fontSize = 17.sp,
                lineHeight = 17.sp,
                fontWeight = FontWeight.Medium,
                color = Colors.FF333333,
            ),
        )

        Spacer(height = 5.5.dp)

        Text(
            text = title,
            style = TextStyle(
                fontSize = 13.sp,
                lineHeight = 14.sp,
                fontWeight = FontWeight.Normal,
                color = Colors.FF999999,
            ),
        )
    }
}