in ui-components/src/commonMain/kotlin/org/jetbrains/kotlinconf/ui/components/Button.kt [30:68]
fun Button(
label: String,
onClick: () -> Unit,
modifier: Modifier = Modifier,
primary: Boolean = false,
enabled: Boolean = true,
) {
val backgroundColor by animateColorAsState(
if (primary) KotlinConfTheme.colors.primaryBackground
else Color.Transparent
)
val borderColor by animateColorAsState(
if (primary) Color.Transparent
else KotlinConfTheme.colors.strokeHalf
)
val textColor by animateColorAsState(
if (primary) KotlinConfTheme.colors.primaryTextWhiteFixed
else KotlinConfTheme.colors.primaryText
)
val alpha by animateFloatAsState(if (enabled) 1f else 0.5f)
Box(
modifier = modifier
.alpha(alpha)
.heightIn(min = 56.dp)
.border(width = 1.dp, color = borderColor, shape = ButtonShape)
.clip(ButtonShape)
.clickable(enabled = enabled, onClick = onClick, role = Role.Button)
.background(backgroundColor)
.padding(horizontal = 32.dp),
contentAlignment = Alignment.Center,
) {
Text(
label,
style = KotlinConfTheme.typography.text1,
color = textColor,
)
}
}