package com.convenient.android.lib.ui.sample.read.annotation

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.items
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.AddCircle
import androidx.compose.material.icons.filled.Edit
import androidx.compose.material.icons.filled.List
import androidx.compose.material.icons.filled.Settings
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp

/**
 * @author: hubowen
 * @date: 2022/9/29
 * @description:
 */

val annotationItemList = arrayListOf(
    BottomItem(title = "注释", Icons.Filled.List),
    BottomItem(title = "背景", Icons.Filled.AddCircle),
    BottomItem(title = "编辑", Icons.Filled.Edit),
    BottomItem(title = "设置", Icons.Filled.Settings),
    BottomItem(title = "注释", Icons.Filled.List),
    BottomItem(title = "背景", Icons.Filled.AddCircle),
    BottomItem(title = "编辑", Icons.Filled.Edit),
    BottomItem(title = "设置", Icons.Filled.Settings),
    BottomItem(title = "注释", Icons.Filled.List),
    BottomItem(title = "背景", Icons.Filled.AddCircle),
    BottomItem(title = "编辑", Icons.Filled.Edit),
    BottomItem(title = "设置", Icons.Filled.Settings)
)

@Composable
fun AnnotationList(
    annotationList: List<BottomItem>,
    onClicked: () -> Unit,
    modifier: Modifier = Modifier,
) {
    LazyRow(
        modifier = modifier.padding(top = 8.dp, bottom = 8.dp),
        horizontalArrangement = Arrangement.spacedBy(8.dp),
        contentPadding = PaddingValues(horizontal = 8.dp)
    ) {
        items(annotationList) {
            AnnotationItem(
                imageId = it.icon,
                annotationName = it.title,
                onClick = onClicked
            )
        }
    }
}
