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

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.ButtonDefaults
import androidx.compose.material.Text
import androidx.compose.material.TextButton
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
import com.ys.bdtp.adm.app.theme.textBlackColor
import com.ys.bdtp.adm.app.theme.whiteColor

@Composable
fun CadHeadMiddle() {
    Row(
        modifier = Modifier
            .width(360.dp)
            .height(32.dp)
            .background(Color.White, shape = RoundedCornerShape(4.dp))
    ) {

        TextButton(
            modifier = Modifier.weight(1f),
            onClick = {},
            contentPadding = PaddingValues(),
            shape = RoundedCornerShape(
                topStart = 4.dp,
                bottomStart = 4.dp,
                topEnd = 0.dp,
                bottomEnd = 0.dp
            ),
            colors = ButtonDefaults.textButtonColors(
                backgroundColor = whiteColor,
                contentColor = textBlackColor
            )
        ) {
            Box {
                Image(
                    modifier = Modifier.fillMaxSize().align(Alignment.Center),
                    painter = painterResource(R.drawable.btn_bg_blue_left_close),
                    contentDescription = ""
                )
                Text(
                    modifier = Modifier.align(Alignment.Center),
                    text = "土建精装图纸核查",
                    color = textBlackColor,
                    fontSize = 14.sp
                )
            }
        }

        TextButton(
            modifier = Modifier.weight(1f),
            onClick = {},
            contentPadding = PaddingValues(),
            shape = RoundedCornerShape(
                topStart = 0.dp,
                bottomStart = 0.dp,
                topEnd = 4.dp,
                bottomEnd = 4.dp
            ),
            colors = ButtonDefaults.textButtonColors(
                backgroundColor = whiteColor,
                contentColor = textBlackColor
            )
        ) {
            Box {
                Image(
                    modifier = Modifier.fillMaxSize().align(Alignment.Center),
                    painter = painterResource(R.drawable.btn_bg_gray_right_open),
                    contentDescription = ""
                )
                Text(
                    modifier = Modifier.align(Alignment.Center),
                    text = "机电管道图纸核查",
                    color = textBlackColor,
                    fontSize = 14.sp
                )
            }
        }

    }
}

@Preview
@Composable
fun PreviewCadHeadMiddle() {
    CadHeadMiddle()
}