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

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.itemsIndexed
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.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp


val titles = listOf("京东科技实验大厦", "souhu科技大厦总部", "印力科技大厦", "天街科技大厦", "腾讯科技大厦总部", "印象城商场大厦")

@Composable
fun ProjectTitleList(titles: List<String>) {

    LazyColumn(
        modifier = Modifier
            .wrapContentWidth()
            .fillMaxHeight()
            .background(Color.White)
    ) {
        itemsIndexed(titles) { index: Int, name: String ->
            if (index == 0) {
                Row(
                    modifier = Modifier
                        .width(170.dp)
                        .height(40.dp)
                        .background(Color(0xFFE0F2FF)),
                    horizontalArrangement = Arrangement.Center,
                    verticalAlignment = Alignment.CenterVertically
                )
                {
                    Text(
                        text = name,
                        fontSize = 14.sp,
                        color = Color(0xFF0091FF),
                    )
                }
            } else {
                Row(

                    modifier = Modifier
                        .width(170.dp)
                        .height(40.dp)
                        .background(Color.White),
                    horizontalArrangement = Arrangement.Center,
                    verticalAlignment = Alignment.CenterVertically
                )
                {
                    Text(
                        text = name,
                        fontSize = 14.sp,
                        color = Color(0xFF1F2429),
                    )
                }
            }
        }
    }
}

@Preview
@Composable
fun PreviewProjectTitleList() {
    ProjectTitleList(titles)
}