Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add action tokens to PrimaryButton with brand base as fallback #3081

Open
wants to merge 10 commits into
base: prerelease/minor
Choose a base branch
from

Conversation

mannycarrera4
Copy link
Contributor

@mannycarrera4 mannycarrera4 commented Dec 19, 2024

Summary

Fixes: #3072

Release Category

Components

Release Note

In @workday/canvas-tokens-web@2.1.0 we've added new action tokens. In most cases you'll use brand.primary.** tokens to override theme. However, in the unique cases where you need additional control. over styling PrimaryButton you can override brand.action.** tokens for more control. This PR ensures that PrimaryButton uses the new action tokens with brand.base.** being a fallback token. There should be no breaking changes as this is an addition to provide more control of theming our PrimaryButton component.

Note: If band.action.** token is defined anywhere at the root level, Primary Buttons will receive that color instead of brand.primary.*.


Checklist

For the Reviewer

  • PR title is short and descriptive
  • PR summary describes the change (Fixes/Resolves linked correctly)
  • PR Release Notes describes additional information useful to call out in a release message or removed if not applicable
  • Breaking Changes provides useful information to upgrade to this code or removed if not applicable

Where Should the Reviewer Start?

Areas for Feedback? (optional)

  • Code
  • Documentation
  • Testing
  • Codemods

Testing Manually

Screenshots or GIFs (if applicable)

Thank You Gif (optional)

Copy link

cypress bot commented Dec 19, 2024

Workday/canvas-kit    Run #8183

Run Properties:  status check passed Passed #8183  •  git commit e32b55a133 ℹ️: Merge fe627c493cd75a6fe90c1eda1c1776939d43753c into 340f917ae60082f246c1ac420140...
Project Workday/canvas-kit
Branch Review mc-action-tokens
Run status status check passed Passed #8183
Run duration 02m 49s
Commit git commit e32b55a133 ℹ️: Merge fe627c493cd75a6fe90c1eda1c1776939d43753c into 340f917ae60082f246c1ac420140...
Committer Manuel Carrera
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 21
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 929
View all changes introduced in this branch ↗︎
UI Coverage  21.24%
  Untested elements 1522  
  Tested elements 408  
Accessibility  99.17%
  Failed rules  6 critical   5 serious   0 moderate   2 minor
  Failed elements 162  

@mannycarrera4 mannycarrera4 marked this pull request as ready for review January 7, 2025 15:47
@mannycarrera4 mannycarrera4 added the ready for review Code is ready for review label Jan 8, 2025

const mergeable: PartialCanvasTheme = {
palette: {
common,
primary: fillPalette(defaultCanvasTheme.palette.primary, primary),
action: fillPalette(defaultCanvasTheme.palette.primary, action || primary),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This bit of code allows for consumers just to define primary and not require them to define action.
The below code when passed to canvas provider will work, with action not being defined.

const customColorTheme: PartialCanvasTheme = {
  palette: {
    primary: {
      main: 'purple',
      contrast: 'turquoise',
    },
    error: {
      main: 'crimson',
    },
    success: {
      main: 'aquamarine',
    },
    neutral: {
      main: 'gray',
    },
    common: {
      focusOutline: 'turquoise',
    },
  },
};

If you pass the following, action will win

const customColorThemeWithAction: PartialCanvasTheme = {
  palette: {
    primary: {
      main: 'purple',
      contrast: 'turquoise',
    },
    action: {
      main: 'red',
    },
    error: {
      main: 'crimson',
    },
    success: {
      main: 'aquamarine',
    },
    neutral: {
      main: 'gray',
    },
    common: {
      focusOutline: 'turquoise',
    },
  },
};

Co-authored-by: Josh <44883293+josh-bagwell@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review Code is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants