2022-07-23 01:05:50 +02:00
|
|
|
package eu.kanade.presentation.components
|
|
|
|
|
2022-10-28 20:28:46 +06:00
|
|
|
import androidx.compose.foundation.layout.Box
|
2022-10-09 11:51:32 -04:00
|
|
|
import androidx.compose.foundation.layout.IntrinsicSize
|
2022-07-23 01:05:50 +02:00
|
|
|
import androidx.compose.foundation.layout.padding
|
2022-10-09 11:51:32 -04:00
|
|
|
import androidx.compose.foundation.layout.requiredWidth
|
2022-07-23 01:05:50 +02:00
|
|
|
import androidx.compose.material3.LocalTextStyle
|
|
|
|
import androidx.compose.material3.MaterialTheme
|
|
|
|
import androidx.compose.material3.Text
|
|
|
|
import androidx.compose.runtime.Composable
|
2022-10-28 20:28:46 +06:00
|
|
|
import androidx.compose.ui.Alignment
|
2022-07-23 01:05:50 +02:00
|
|
|
import androidx.compose.ui.Modifier
|
2022-10-09 11:51:32 -04:00
|
|
|
import androidx.compose.ui.graphics.Color
|
2022-07-23 01:05:50 +02:00
|
|
|
import androidx.compose.ui.unit.Dp
|
|
|
|
import androidx.compose.ui.unit.TextUnit
|
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
fun Pill(
|
|
|
|
text: String,
|
|
|
|
modifier: Modifier = Modifier,
|
2022-10-09 11:51:32 -04:00
|
|
|
color: Color = MaterialTheme.colorScheme.background,
|
|
|
|
contentColor: Color = MaterialTheme.colorScheme.onBackground,
|
2022-07-23 01:05:50 +02:00
|
|
|
elevation: Dp = 1.dp,
|
|
|
|
fontSize: TextUnit = LocalTextStyle.current.fontSize,
|
|
|
|
) {
|
|
|
|
androidx.compose.material3.Surface(
|
|
|
|
modifier = modifier
|
2022-10-28 20:28:46 +06:00
|
|
|
.padding(start = 4.dp),
|
2022-10-28 16:18:05 -04:00
|
|
|
shape = MaterialTheme.shapes.extraLarge,
|
2022-07-23 01:05:50 +02:00
|
|
|
color = color,
|
|
|
|
contentColor = contentColor,
|
|
|
|
tonalElevation = elevation,
|
|
|
|
) {
|
2022-10-28 20:28:46 +06:00
|
|
|
Box(
|
|
|
|
modifier = Modifier
|
|
|
|
.requiredWidth(IntrinsicSize.Max)
|
|
|
|
.padding(6.dp, 1.dp),
|
|
|
|
contentAlignment = Alignment.Center,
|
|
|
|
) {
|
|
|
|
Text(
|
|
|
|
text = text,
|
|
|
|
fontSize = fontSize,
|
|
|
|
maxLines = 1,
|
|
|
|
)
|
|
|
|
}
|
2022-07-23 01:05:50 +02:00
|
|
|
}
|
|
|
|
}
|