[fenix] For https://github.com/mozilla-mobile/fenix/issues/27485 - Add optional overrides for the colors in `Button` Composables

pull/600/head
Noah Bond 2 years ago committed by mergify[bot]
parent 71279545a5
commit 4c94b0dc63

@ -38,7 +38,7 @@ import org.mozilla.fenix.theme.Theme
* @param onClick Invoked when the user clicks on the button. * @param onClick Invoked when the user clicks on the button.
*/ */
@Composable @Composable
fun Button( private fun Button(
text: String, text: String,
textColor: Color, textColor: Color,
backgroundColor: Color, backgroundColor: Color,
@ -79,19 +79,23 @@ fun Button(
* Primary button. * Primary button.
* *
* @param text The button text to be displayed. * @param text The button text to be displayed.
* @param textColor [Color] to apply to the button text.
* @param backgroundColor The background [Color] of the button.
* @param icon Optional [Painter] used to display an [Icon] before the button text. * @param icon Optional [Painter] used to display an [Icon] before the button text.
* @param onClick Invoked when the user clicks on the button. * @param onClick Invoked when the user clicks on the button.
*/ */
@Composable @Composable
fun PrimaryButton( fun PrimaryButton(
text: String, text: String,
textColor: Color = FirefoxTheme.colors.textActionPrimary,
backgroundColor: Color = FirefoxTheme.colors.actionPrimary,
icon: Painter? = null, icon: Painter? = null,
onClick: () -> Unit, onClick: () -> Unit,
) { ) {
Button( Button(
text = text, text = text,
textColor = FirefoxTheme.colors.textActionPrimary, textColor = textColor,
backgroundColor = FirefoxTheme.colors.actionPrimary, backgroundColor = backgroundColor,
icon = icon, icon = icon,
tint = FirefoxTheme.colors.iconActionPrimary, tint = FirefoxTheme.colors.iconActionPrimary,
onClick = onClick, onClick = onClick,
@ -129,19 +133,23 @@ fun SecondaryButton(
* Tertiary button. * Tertiary button.
* *
* @param text The button text to be displayed. * @param text The button text to be displayed.
* @param textColor [Color] to apply to the button text.
* @param backgroundColor The background [Color] of the button.
* @param icon Optional [Painter] used to display an [Icon] before the button text. * @param icon Optional [Painter] used to display an [Icon] before the button text.
* @param onClick Invoked when the user clicks on the button. * @param onClick Invoked when the user clicks on the button.
*/ */
@Composable @Composable
fun TertiaryButton( fun TertiaryButton(
text: String, text: String,
textColor: Color = FirefoxTheme.colors.textActionTertiary,
backgroundColor: Color = FirefoxTheme.colors.actionTertiary,
icon: Painter? = null, icon: Painter? = null,
onClick: () -> Unit, onClick: () -> Unit,
) { ) {
Button( Button(
text = text, text = text,
textColor = FirefoxTheme.colors.textActionTertiary, textColor = textColor,
backgroundColor = FirefoxTheme.colors.actionTertiary, backgroundColor = backgroundColor,
icon = icon, icon = icon,
tint = FirefoxTheme.colors.iconActionTertiary, tint = FirefoxTheme.colors.iconActionTertiary,
onClick = onClick, onClick = onClick,
@ -152,19 +160,23 @@ fun TertiaryButton(
* Destructive button. * Destructive button.
* *
* @param text The button text to be displayed. * @param text The button text to be displayed.
* @param textColor [Color] to apply to the button text.
* @param backgroundColor The background [Color] of the button.
* @param icon Optional [Painter] used to display an [Icon] before the button text. * @param icon Optional [Painter] used to display an [Icon] before the button text.
* @param onClick Invoked when the user clicks on the button. * @param onClick Invoked when the user clicks on the button.
*/ */
@Composable @Composable
fun DestructiveButton( fun DestructiveButton(
text: String, text: String,
textColor: Color = FirefoxTheme.colors.textWarningButton,
backgroundColor: Color = FirefoxTheme.colors.actionSecondary,
icon: Painter? = null, icon: Painter? = null,
onClick: () -> Unit, onClick: () -> Unit,
) { ) {
Button( Button(
text = text, text = text,
textColor = FirefoxTheme.colors.textWarningButton, textColor = textColor,
backgroundColor = FirefoxTheme.colors.actionSecondary, backgroundColor = backgroundColor,
icon = icon, icon = icon,
tint = FirefoxTheme.colors.iconWarningButton, tint = FirefoxTheme.colors.iconWarningButton,
onClick = onClick, onClick = onClick,

Loading…
Cancel
Save