package com.ys.bdtp.adm.mvvm.ui.screen.project

import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.GridCells
import androidx.compose.foundation.lazy.LazyVerticalGrid
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp


@OptIn(ExperimentalFoundationApi::class)
@Composable
fun Project() {
    Column {
        Text(text = "可进入的项目（10）", fontSize = 20.sp, fontWeight = FontWeight.Bold, color = Color(0xFF1F2329))
        Spacer(modifier = Modifier.height(12.dp))
        LazyVerticalGrid(
            cells = GridCells.Fixed(2),
        ) {
            items(20) {
                if (it % 2 == 0)
                    Row(modifier = Modifier.padding(end = 10.dp, bottom = 20.dp)) {
                        ProjectItem()
                    }
                else {
                    Row(modifier = Modifier.padding(start = 10.dp, bottom = 20.dp)) {
                        ProjectItem()
                    }
                }
            }
        }
    }
}

@Preview(
    widthDp = 1280,
    heightDp = 800,
    showBackground = true,
    backgroundColor = 0xFFFFFFFF
)
@Composable
fun PreviewProject() {
    Project()
}