Don't wrap tab pills

It may sometimes overlap the text a bit, but it's less awkward than wrapped pills
This commit is contained in:
arkon 2022-10-09 11:51:32 -04:00
parent d0950cb026
commit b84a31ba92

View File

@ -1,6 +1,8 @@
package eu.kanade.presentation.components
import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.requiredWidth
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.MaterialTheme
@ -8,6 +10,7 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.dp
@ -16,13 +19,14 @@ import androidx.compose.ui.unit.dp
fun Pill(
text: String,
modifier: Modifier = Modifier,
color: androidx.compose.ui.graphics.Color = MaterialTheme.colorScheme.background,
contentColor: androidx.compose.ui.graphics.Color = MaterialTheme.colorScheme.onBackground,
color: Color = MaterialTheme.colorScheme.background,
contentColor: Color = MaterialTheme.colorScheme.onBackground,
elevation: Dp = 1.dp,
fontSize: TextUnit = LocalTextStyle.current.fontSize,
) {
androidx.compose.material3.Surface(
modifier = modifier
.requiredWidth(IntrinsicSize.Max)
.padding(start = 4.dp)
.clip(RoundedCornerShape(100)),
color = color,
@ -33,6 +37,8 @@ fun Pill(
text = text,
modifier = Modifier.padding(6.dp, 1.dp),
fontSize = fontSize,
maxLines = 1,
softWrap = false,
)
}
}