2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-15 18:12:54 +00:00

For #27485 - Add optional overrides for the colors in Button Composables

This commit is contained in:
Noah Bond 2022-11-01 10:16:34 -07:00 committed by mergify[bot]
parent 0933f901fc
commit 8857073e5b

View File

@ -38,7 +38,7 @@ import org.mozilla.fenix.theme.Theme
* @param onClick Invoked when the user clicks on the button.
*/
@Composable
fun Button(
private fun Button(
text: String,
textColor: Color,
backgroundColor: Color,
@ -79,19 +79,23 @@ fun Button(
* Primary button.
*
* @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 onClick Invoked when the user clicks on the button.
*/
@Composable
fun PrimaryButton(
text: String,
textColor: Color = FirefoxTheme.colors.textActionPrimary,
backgroundColor: Color = FirefoxTheme.colors.actionPrimary,
icon: Painter? = null,
onClick: () -> Unit,
) {
Button(
text = text,
textColor = FirefoxTheme.colors.textActionPrimary,
backgroundColor = FirefoxTheme.colors.actionPrimary,
textColor = textColor,
backgroundColor = backgroundColor,
icon = icon,
tint = FirefoxTheme.colors.iconActionPrimary,
onClick = onClick,
@ -129,19 +133,23 @@ fun SecondaryButton(
* Tertiary button.
*
* @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 onClick Invoked when the user clicks on the button.
*/
@Composable
fun TertiaryButton(
text: String,
textColor: Color = FirefoxTheme.colors.textActionTertiary,
backgroundColor: Color = FirefoxTheme.colors.actionTertiary,
icon: Painter? = null,
onClick: () -> Unit,
) {
Button(
text = text,
textColor = FirefoxTheme.colors.textActionTertiary,
backgroundColor = FirefoxTheme.colors.actionTertiary,
textColor = textColor,
backgroundColor = backgroundColor,
icon = icon,
tint = FirefoxTheme.colors.iconActionTertiary,
onClick = onClick,
@ -152,19 +160,23 @@ fun TertiaryButton(
* Destructive button.
*
* @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 onClick Invoked when the user clicks on the button.
*/
@Composable
fun DestructiveButton(
text: String,
textColor: Color = FirefoxTheme.colors.textWarningButton,
backgroundColor: Color = FirefoxTheme.colors.actionSecondary,
icon: Painter? = null,
onClick: () -> Unit,
) {
Button(
text = text,
textColor = FirefoxTheme.colors.textWarningButton,
backgroundColor = FirefoxTheme.colors.actionSecondary,
textColor = textColor,
backgroundColor = backgroundColor,
icon = icon,
tint = FirefoxTheme.colors.iconWarningButton,
onClick = onClick,