package com.suno.android.ui.bottom_sheets.option_picker import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.itemsIndexed import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.key import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.painter.Painter import androidx.compose.ui.unit.dp import com.suno.android.common_ui.theme.ExtendedTheme import kotlinx.collections.immutable.ImmutableList data class OptionPickerUi( val painter: Painter, val text: String, val description: String? = null, ) @Composable fun OptionPickerContent( options: ImmutableList, getUiForOption: @Composable (T) -> OptionPickerUi, onOptionClick: (T) -> Unit, modifier: Modifier = Modifier, ) { Box( modifier = modifier.padding(start = 16.dp, end = 16.dp, bottom = 16.dp), ) { Surface( color = ExtendedTheme.colors.backgroundTertiary, shape = MaterialTheme.shapes.large, ) { LazyColumn { itemsIndexed( items = options, ) { index, option -> key(option) { val ui = getUiForOption(option) Row( horizontalArrangement = Arrangement.spacedBy(10.dp), verticalAlignment = Alignment.CenterVertically, modifier = Modifier .fillMaxWidth() .heightIn(56.dp) .clickable { onOptionClick(option) } .padding(16.dp), ) { Icon( painter = ui.painter, contentDescription = null, modifier = Modifier.size(24.dp), ) Column( modifier = Modifier.weight(1f), ) { Text( text = ui.text, style = ExtendedTheme.typography.smallBody, ) ui.description?.let { description -> Text( text = description, style = ExtendedTheme.typography.smallBody, color = ExtendedTheme.colors.textTertiary, ) } } } if (index != options.lastIndex) { HorizontalDivider() } } } } } } }