in ui-components/src/commonMain/kotlin/org/jetbrains/kotlinconf/ui/components/FiltersTag.kt [29:74]
fun FilterTag(
label: String,
selected: Boolean,
onSelect: (Boolean) -> Unit,
modifier: Modifier = Modifier,
) {
val backgroundColor by animateColorAsState(
if (selected) KotlinConfTheme.colors.primaryBackground
else KotlinConfTheme.colors.mainBackground,
ColorSpringSpec,
)
val textColor by animateColorAsState(
if (selected) KotlinConfTheme.colors.primaryTextWhiteFixed
else KotlinConfTheme.colors.primaryText,
ColorSpringSpec,
)
val strokeColor by animateColorAsState(
if (selected) Color.Transparent
else KotlinConfTheme.colors.strokeFull,
ColorSpringSpec,
)
Box(
modifier = modifier
.clip(FilterTagShape)
.border(
width = 1.dp,
color = strokeColor,
shape = FilterTagShape,
)
.selectable(
selected = selected,
onClick = { onSelect(!selected) },
role = Role.RadioButton
)
.background(backgroundColor)
.padding(horizontal = 12.dp, vertical = 10.dp),
contentAlignment = Alignment.Center,
) {
Text(
label,
style = KotlinConfTheme.typography.text1,
color = textColor,
)
}
}