-
Notifications
You must be signed in to change notification settings - Fork 1.3k
For #27468 - Backplate homepage MessageCard #27677
For #27468 - Backplate homepage MessageCard #27677
Conversation
val defaultMessageCardColors = MessageCardColors.buildMessageCardColors() | ||
|
||
var buttonColor = defaultMessageCardColors.buttonColor | ||
var buttonTextColor = defaultMessageCardColors.buttonTextColor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
val defaultMessageCardColors = MessageCardColors.buildMessageCardColors() | |
var buttonColor = defaultMessageCardColors.buttonColor | |
var buttonTextColor = defaultMessageCardColors.buttonTextColor | |
var (buttonColor, buttonTextColor) = MessageCardColors.buildMessageCardColors() |
Wondering if we could use destructuring declaration here to save us a few lines https://kotlinlang.org/docs/destructuring-declarations.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we wanted to go fully immutable you may be able to do something like this, even:
val (buttonColor, buttonTextColor) = if (isWallpaperNotDefault) {
FirefoxTheme.colors.layer1 to if (!isSystemInDarkTheme()) { FirefoxTheme.colors.textActionSecondary } else defaultMessageCardColors.buttonTextColor
} else {
MessageCardColors.buildMessageCardColors()
}
Definitely a little code golfy though 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had no idea about the destructuring! that's really cool! I had to just insert some underscores though, as the destructuring is tied to the ordering of the parameters.
var (_, _, _, _, buttonColor, buttonTextColor) = MessageCardColors.buildMessageCardColors()
d4b8d83
to
1be535c
Compare
Looks Correct! |
In essence, this section is styled the same as the recent synced tab (Jump back in)
Pull Request checklist
QA
To download an APK when reviewing a PR (after all CI tasks finished running):
Checks
at the top of the PR page.firefoxci-taskcluster
group on the left to expand all tasks.build-debug
task.View task in Taskcluster
in the newDETAILS
section.GitHub Automation
Fixes #27468