fun IconButton()

in ui-components/src/commonMain/kotlin/org/jetbrains/kotlinconf/ui/components/IconButton.kt [32:65]


fun IconButton(
    icon: DrawableResource,
    enabled: Boolean,
    onClick: () -> Unit,
    modifier: Modifier = Modifier,
    contentDescription: String? = null,
) {
    val strokeColor by animateColorAsState(
        if (enabled) KotlinConfTheme.colors.strokeHalf
        else KotlinConfTheme.colors.strokePale
    )
    val iconColor by animateColorAsState(
        if (enabled) KotlinConfTheme.colors.primaryText
        else KotlinConfTheme.colors.placeholderText
    )

    Box(
        modifier
            .size(48.dp)
            .aspectRatio(1f)
            .clip(CircleShape)
            .border(1.dp, strokeColor, CircleShape)
            .clickable(enabled = enabled, onClick = onClick, role = Role.Button)
            .background(KotlinConfTheme.colors.mainBackground),
        contentAlignment = Alignment.Center,
    ) {
        Icon(
            painter = painterResource(icon),
            contentDescription = contentDescription,
            tint = iconColor,
            modifier = Modifier.size(24.dp)
        )
    }
}