Skip to content

task(settings): Support additional layout customization#19926

Merged
vpomerleau merged 1 commit intomainfrom
FXA-12791
Jan 28, 2026
Merged

task(settings): Support additional layout customization#19926
vpomerleau merged 1 commit intomainfrom
FXA-12791

Conversation

@vpomerleau
Copy link
Copy Markdown
Contributor

@vpomerleau vpomerleau commented Jan 23, 2026

Because

  • We want to allow setting a gradient as button colour
  • We want to allow customization of headline text size and color

This pull request

  • Update the CmsButtonWithFallback component to support setting a gradient as buttonColor
  • Update calculate-contrast to provide better contrast on light colour gradient
  • Update cta styling to prevent a border artifact when background is gradient
  • Support headlineFontSize and headlineTextColor attributes from cmsInfo

Issue that this pull request solves

Closes: FXA-12791

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).

Screenshots (Optional)

Example medium headline font size with blue text and gradient button
image

Button styling examples from storybook with automated text color adjustments based on contrast with button colour.
image

Other information (Optional)

Testing requires:

@vpomerleau vpomerleau marked this pull request as ready for review January 23, 2026 20:32
@vpomerleau vpomerleau requested a review from a team as a code owner January 23, 2026 20:32
}

function calculateGradientContrast(gradient: string): string {
function calculateGradientContrast(
Copy link
Copy Markdown
Contributor

@dschom dschom Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that your other functions have jsdoc comments. Can we add them across the board?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added!

featureFlags?: FeatureFlagsRelierCmsInfo | undefined;
favicon?: string | undefined;
// Note: The backend may return this as an enum, but the values are compatible strings
headlineFontSize?: HeadlineFontSize | string | null;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to break the pattern by using | null instead of | undefined. Is there a reason for this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null aligns with the generated types in libs/shared/cms, though I'm not sure why others here have undefined


export const CmsHeaderComparison = () => (
<AppLayout>
<div style={{ display: 'flex', flexDirection: 'column', gap: '40px' }}>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only nit about all these extra inline styles is I hope folks see this as a storybook only sorta thing (well and PDFs), and if we change the design system values we won't be changing these, but I don't necessarily have a better suggestion since I know Tailwind's not looking at these files and nor should we want it to so 🤷‍♀️ In a perfect world we could create reusable Storybook components.

(Nothing to do here, I'm just mumbling to myself 😄)

Comment thread packages/fxa-settings/src/components/CardHeader/index.tsx
Comment thread packages/fxa-react/styles/ctas.css Outdated

/* For gradient buttons, maintain the gradient on active state */
.cta-primary-cms.cta-gradient:active:not([aria-disabled='true']) {
background-color: transparent !important;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need !important?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this again, I decided to tweak hover/active styling to add contrast for gradient background and removed !important. It looks like the specificity is high enough that it will take priority.

Comment thread packages/fxa-settings/src/components/CardHeader/index.tsx
const textColorClass = getTextColorClassName(buttonColor, 'maximum');
// Map textColorClass to actual CSS color value
const mappedTextColor =
TEXT_COLOR_CSS_VALUES[textColorClass] || 'rgb(0, 0, 0)';
Copy link
Copy Markdown
Contributor

@LZoog LZoog Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the fallback be our text-grey-900 instead of text-black? (Maybe not)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, good call. I'll use that as the standard dark contrast option

Because:

* We want to allow setting a gradient as button colour
* We want to allow customization of headline text size and color

This commit:

* Update the CmsButtonWithFallback component to support setting a gradient as buttonColor
* Update calculate-contrast to provide better contrast on light colour gradient
* Update cta styling to prevent a border artifact when background is gradient
* Support headlineFontSize and headlineTextColor attributes from cmsInfo

Closes #FXA-12791
Copy link
Copy Markdown
Contributor

@LZoog LZoog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Paired in Zoom for testing locally. LGTM!!

@vpomerleau vpomerleau merged commit fe3db08 into main Jan 28, 2026
21 checks passed
@vpomerleau vpomerleau deleted the FXA-12791 branch January 28, 2026 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants