in ui-components/src/commonMain/kotlin/org/jetbrains/kotlinconf/ui/components/TopMenuButton.kt [119:148]
fun TopMenuButton(
icon: DrawableResource,
selected: Boolean = false,
onToggle: (Boolean) -> Unit,
contentDescription: String,
modifier: Modifier = Modifier,
) {
val backgroundColor by animateColorAsState(
if (selected) KotlinConfTheme.colors.primaryBackground
else Color.Transparent
)
val iconColor by animateColorAsState(
if (selected) KotlinConfTheme.colors.primaryTextWhiteFixed
else KotlinConfTheme.colors.primaryText
)
TopMenuButtonImpl(
icon = icon,
contentDescription = contentDescription,
modifier = modifier,
interactionModifier = Modifier.toggleable(
value = selected,
enabled = true,
onValueChange = onToggle,
role = Role.Switch,
),
backgroundColor = backgroundColor,
iconColor = iconColor,
)
}