in src/main/kotlin/org/jetbrains/plugins/template/components/SearchBarWithAutoCompletion.kt [123:147]
fun CloseIconButton(onClick: () -> Unit) {
val interactionSource = remember { MutableInteractionSource() }
var hovered by remember { mutableStateOf(false) }
LaunchedEffect(interactionSource) {
interactionSource.interactions.collect {
when (it) {
is HoverInteraction.Enter -> hovered = true
is HoverInteraction.Exit -> hovered = false
}
}
}
Icon(
key = if (hovered) AllIconsKeys.Actions.CloseHovered else AllIconsKeys.Actions.Close,
contentDescription = ComposeTemplateBundle.message("weather.app.clear.button.content.description"),
modifier = Modifier
.pointerHoverIcon(PointerIcon.Default)
.clickable(
interactionSource = interactionSource,
indication = null,
role = Role.Button,
) { onClick() },
)
}