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

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Card
import androidx.compose.material.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.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.ys.bdtp.adm.R

@Composable
fun ProjectItem() {

    Card(
        modifier = Modifier
            .width(570.dp)
            .height(186.dp)
            .border(
                width = 0.5.dp,
                color = Color(0xFFE5E5E5),
                shape = RoundedCornerShape(0)
            )
            .background(Color.Transparent),
        shape = RoundedCornerShape(0)
    ) {
        Row(
            modifier = Modifier
                .padding(start = 28.dp, top = 28.dp, bottom = 28.dp),
            verticalAlignment = Alignment.CenterVertically
        ) {

            Image(
                painter = painterResource(R.drawable.project_item_placeholder),
                contentDescription = "",
                modifier = Modifier.width(130.dp).height(130.dp)
            )

            Spacer(modifier = Modifier.width(28.dp))

            Column(
                modifier = Modifier.fillMaxHeight(),
                verticalArrangement = Arrangement.SpaceAround
            ) {
                Text(text = "京东科技大厦", color = Color(0xFF1F2429), fontSize = 20.sp)
                Text(text = "项目ID:Ewq2123", color = Color(0xFF1F2429), fontSize = 16.sp)
                Text(text = "项目角色:项目管理", color = Color(0xFF1F2429), fontSize = 16.sp)
            }

            Spacer(modifier = Modifier.width(28.dp))

            Column(
                modifier = Modifier.fillMaxHeight(),
                verticalArrangement = Arrangement.SpaceAround
            ) {
                Text(text = "项目开始时间：？", color = Color(0xFF1F2429), fontSize = 16.sp)
                Text(text = "项目完成时间：？", color = Color(0xFF1F2429), fontSize = 16.sp)
            }
        }
    }
}

@Preview
@Composable
fun PreviewProjectItem() {
    ProjectItem()
}