package com.zaojiao.app.feat.home.index

import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import com.zaojiao.component.common.grid
import com.zaojiao.component.common.list

@OptIn(ExperimentalFoundationApi::class)
@Composable
fun HomeIndexPage() {
    LazyColumn(
        modifier = Modifier
            .background(color = Color(0xFFFBFCFD))
            .statusBarsPadding()
            .fillMaxSize(),
    ) {
        stickyHeader {
            HomeIndexTopBar()
        }

        item {
            HomeIndexSwiper()
        }

        item {
            HomeIndexActionBar()
        }

        item {
            HomeIndexSwiper2()
        }

        item {
            HomeIndexTopic()
        }

        item {
            HomeIndexAudio()
        }

        item {
            HomeIndexCourse()
        }

        list(
            count = 5,
            itemContent = { index -> HomeIndexCourseRecommendItem() },
            itemSeparation = { index -> Box(modifier = Modifier.height(16.dp)) }
        )

        item {
            Box(modifier = Modifier.height(20.dp))
        }

        item {
            HomeIndexGood()
        }

        grid(
            count = 10,
            span = 2,
            hSpace = 13.dp,
            vSpace = 13.dp,
            padding = 16.dp,
            isVertical = true,
        ) { index ->
            HomeIndexGoodRecommendItem()
        }

        item {
            Box(modifier = Modifier.height(40.dp))
        }
    }
}