package com.zaojiao.app.feat.home.course

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.statusBarsPadding
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.res.painterResource
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.app.feat.home.R
import com.zaojiao.component.common.Colors
import com.zaojiao.component.common.Spacer

@Composable
internal fun HomeCourseTopBar() {
    Row(
        modifier = Modifier
            .background(color = Color.White)
            .statusBarsPadding()
            .padding(horizontal = 16.dp, vertical = 14.dp)
            .height(34.dp)
            .fillMaxWidth(),
        verticalAlignment = Alignment.CenterVertically,
    ) {
        Text(
            text = "探索空间",
            style = TextStyle(
                fontSize = 20.sp,
                lineHeight = 28.sp,
                fontWeight = FontWeight.SemiBold,
                color = Color(0xFF333333),
            ),
        )
        Spacer(width = 16.dp)
        HomeCourseTopSearchBar()
        Spacer(width = 10.dp)
        Image(
            painter = painterResource(id = R.mipmap.course_learn),
            contentDescription = "正在学习的课程",
        )
    }
}

@Composable
private fun RowScope.HomeCourseTopSearchBar() {
    Box(
        modifier = Modifier
            .background(
                color = Colors.from("#FFF1F6FF"),
                shape = RoundedCornerShape(100.dp),
            )
            .weight(1f)
            .padding(horizontal = 10.dp)
            .fillMaxHeight(),
    ) {

    }
}