1package com.peachpasswords.ui.components23import androidx.compose.foundation.layout.Arrangement4import androidx.compose.foundation.layout.Box5import androidx.compose.foundation.layout.Row6import androidx.compose.foundation.layout.RowScope7import androidx.compose.foundation.layout.fillMaxWidth8import androidx.compose.foundation.layout.height9import androidx.compose.foundation.layout.padding10import androidx.compose.foundation.layout.widthIn11import androidx.compose.foundation.shape.RoundedCornerShape12import androidx.compose.material3.MaterialTheme13import androidx.compose.material3.Surface14import androidx.compose.material3.Text15import androidx.compose.runtime.Composable16import androidx.compose.ui.Alignment17import androidx.compose.ui.Modifier18import androidx.compose.ui.text.style.TextOverflow19import androidx.compose.ui.unit.dp20import com.peachpasswords.ui.theme.PeachSpacing21import com.peachpasswords.ui.theme.PeachType2223@Composable24fun PeachTopBar(25 title: String,26 modifier: Modifier = Modifier,27 leading: (@Composable RowScope.() -> Unit)? = null,28 actions: (@Composable RowScope.() -> Unit)? = null,29) {30 Surface(31 modifier = modifier.fillMaxWidth(),32 33 34 35 color = MaterialTheme.colorScheme.surface,36 contentColor = MaterialTheme.colorScheme.onSurface,37 shape = RoundedCornerShape(18.dp),38 tonalElevation = 1.dp,39 ) {40 Row(41 modifier = Modifier42 .height(56.dp)43 .padding(horizontal = PeachSpacing.md),44 verticalAlignment = Alignment.CenterVertically,45 horizontalArrangement = Arrangement.spacedBy(PeachSpacing.sm),46 ) {47 if (leading != null) {48 Row(verticalAlignment = Alignment.CenterVertically, content = leading)49 }50 Text(51 text = title,52 color = MaterialTheme.colorScheme.onSurface,53 style = PeachType.wordmark,54 maxLines = 1,55 overflow = TextOverflow.Ellipsis,56 modifier = Modifier.weight(1f),57 )58 if (actions != null) {59 Row(60 modifier = Modifier.widthIn(min = 40.dp),61 verticalAlignment = Alignment.CenterVertically,62 horizontalArrangement = Arrangement.spacedBy(PeachSpacing.xs),63 content = actions,64 )65 } else {66 Box(Modifier.widthIn(min = 40.dp))67 }68 }69 }70}