package com.suno.android.ui.screens.songdetails import androidx.compose.foundation.background import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.foundation.text.BasicTextField import androidx.compose.material3.Text import androidx.compose.material3.TextFieldDefaults import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.SolidColor import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.VisualTransformation import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.suno.android.common_ui.theme.ExtendedTheme import com.suno.android.common_ui.theme.SunoTheme import com.suno.android.common_res.R as CommonResR @Composable fun SongDetailsLyricsInput( lyrics: String, onLyricsChange: (text: String) -> Unit, ) { val interactionSource = remember { MutableInteractionSource() } BasicTextField( modifier = Modifier.fillMaxSize(), value = lyrics, onValueChange = { onLyricsChange(it) }, interactionSource = interactionSource, textStyle = ExtendedTheme.typography.smallSubtitle.copy(color = ExtendedTheme.colors.textPrimary), cursorBrush = SolidColor(ExtendedTheme.colors.sunoPink), ) { innerTextField -> TextFieldDefaults.DecorationBox( value = lyrics, innerTextField = innerTextField, interactionSource = interactionSource, contentPadding = PaddingValues(0.dp), enabled = true, singleLine = false, visualTransformation = VisualTransformation.None, colors = TextFieldDefaults.colors( cursorColor = ExtendedTheme.colors.sunoPink, focusedTextColor = ExtendedTheme.colors.textSecondary, unfocusedTextColor = ExtendedTheme.colors.textSecondary, unfocusedContainerColor = Color.Transparent, focusedContainerColor = Color.Transparent, unfocusedIndicatorColor = Color.Transparent, focusedIndicatorColor = Color.Transparent, ), ) if (lyrics.isEmpty()) { Text( text = stringResource(CommonResR.string.song_details_input_lyrics_placeholder), style = ExtendedTheme.typography.smallSubtitle, color = ExtendedTheme.colors.foregroundInactive, modifier = Modifier.padding(top = 4.dp), ) } } } @Preview @Composable private fun SongDetailsLyricsInput_Empty_Preview() { SunoTheme { Column( modifier = Modifier .fillMaxSize() .background(ExtendedTheme.colors.backgroundPrimary), ) { SongDetailsLyricsInput( lyrics = "", onLyricsChange = {}, ) } } } @Preview @Composable private fun SongDetailsLyricsInput_Filled_Preview() { SunoTheme { Column( modifier = Modifier .fillMaxSize() .background(ExtendedTheme.colors.backgroundPrimary), ) { SongDetailsLyricsInput( lyrics = Mocks.MOCK_LYRICS, onLyricsChange = {}, ) } } }