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

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.material.IconButton
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.text.font.FontWeight.Companion.Bold
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavHostController
import com.ys.bdtp.adm.R
import com.ys.bdtp.adm.mvvm.ui.screen.home.LocalNavHostController

@Composable
fun OfflineHeadLeft(nav: NavHostController) {
    Row(
        verticalAlignment = Alignment.CenterVertically,
        horizontalArrangement = Arrangement.Start
    ) {

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

        IconButton(onClick = {
            nav.navigateUp()
        }) {
            Image(
                painter = painterResource(R.drawable.arrow_back),
                contentDescription = "",
                modifier = Modifier.size(24.dp)
            )
        }

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

        Spacer(
            modifier = Modifier
                .width(1.dp)
                .height(16.dp)
                .background(Color(0xFFD8D8D8))
        )

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

        Text(text = "离线数据", fontSize = 16.sp, fontWeight = Bold, color = Color(0xFF1F2329))
    }
}


@Preview
@Composable
fun PreviewOfflineHeadLeft() {
    val nav = LocalNavHostController.current!!
    OfflineHeadLeft(nav)
}
