2022-07-16 17:40:40 -04:00
|
|
|
package eu.kanade.presentation.components
|
2022-07-16 21:06:24 +02:00
|
|
|
|
|
|
|
import androidx.compose.foundation.background
|
|
|
|
import androidx.compose.foundation.layout.Row
|
|
|
|
import androidx.compose.foundation.layout.RowScope
|
|
|
|
import androidx.compose.foundation.layout.padding
|
|
|
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
|
|
import androidx.compose.material3.MaterialTheme
|
|
|
|
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.graphics.RectangleShape
|
|
|
|
import androidx.compose.ui.graphics.Shape
|
2022-07-16 17:40:40 -04:00
|
|
|
import androidx.compose.ui.text.font.FontWeight
|
2022-07-16 21:06:24 +02:00
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
fun BadgeGroup(
|
|
|
|
modifier: Modifier = Modifier,
|
|
|
|
shape: Shape = RoundedCornerShape(4.dp),
|
|
|
|
content: @Composable RowScope.() -> Unit,
|
|
|
|
) {
|
|
|
|
Row(modifier = modifier.clip(shape)) {
|
|
|
|
content()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
fun Badge(
|
|
|
|
text: String,
|
|
|
|
color: Color = MaterialTheme.colorScheme.secondary,
|
|
|
|
textColor: Color = MaterialTheme.colorScheme.onSecondary,
|
|
|
|
shape: Shape = RectangleShape,
|
|
|
|
) {
|
2022-07-30 22:47:27 +07:00
|
|
|
Text(
|
|
|
|
text = text,
|
2022-07-16 21:06:24 +02:00
|
|
|
modifier = Modifier
|
2022-07-23 01:05:50 +02:00
|
|
|
.clip(shape)
|
2022-07-30 22:47:27 +07:00
|
|
|
.background(color)
|
|
|
|
.padding(horizontal = 3.dp, vertical = 1.dp),
|
|
|
|
color = textColor,
|
|
|
|
fontWeight = FontWeight.Medium,
|
|
|
|
maxLines = 1,
|
|
|
|
style = MaterialTheme.typography.bodySmall,
|
|
|
|
)
|
2022-07-16 21:06:24 +02:00
|
|
|
}
|