in authentication/src/main/kotlin/com/uber/sdk2/auth/ui/UberAuthButton.kt [45:84]
fun UberAuthButton(
isWhite: Boolean = false,
shape: Shape = MaterialTheme.shapes.large,
onClick: () -> Unit,
) {
val text = stringResource(id = com.uber.sdk2.auth.R.string.ub__sign_in)
val interactionSource = remember { MutableInteractionSource() }
val isPressed = interactionSource.collectIsPressedAsState().value
val backgroundColor =
if (isPressed) {
MaterialTheme.colorScheme.onSecondary
} else {
MaterialTheme.colorScheme.onPrimary
}
val textColor = MaterialTheme.colorScheme.primary
val iconResId = if (isWhite) R.drawable.uber_logotype_black else R.drawable.uber_logotype_white
Button(
onClick = onClick,
modifier = Modifier.wrapContentSize(),
colors =
ButtonDefaults.buttonColors(containerColor = backgroundColor, contentColor = textColor),
shape = shape,
interactionSource = interactionSource,
) {
Icon(
painter = painterResource(id = iconResId),
contentDescription = null,
modifier = Modifier.padding(end = UberDimens.signInMargin),
)
Text(
text = text.uppercase(),
color = textColor,
style = UberTypography.bodyMedium,
modifier = Modifier.padding(UberDimens.standardPadding).wrapContentWidth(),
)
}
}