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

chore: Refactored Button styles to use createStyles utility #2285

Merged
merged 105 commits into from
Oct 18, 2023

Conversation

josh-bagwell
Copy link
Contributor

@josh-bagwell josh-bagwell commented Jul 13, 2023

Summary

Style refactor for buttons to work with new theming, branding, tokens, createStyles utility and cs prop.

Fixes: #2274

We want to more easily apply theming to Buttons and the styles need to be refactored to more easily apply those themed styles with new tokens.

Release Category

Components

BREAKING CHANGES

  • We refactored how we styled Buttons to use our createStyles utility function. We don't anticipate
    this as a breaking change but, there may be slight changes to visual test.
  • Icons will no longer be "filled" on toggle. This decision was made to not have the existing icon
    look different in the toggled state from default state.
  • PrimaryButton: On the inverse variant, the focus ring is now consistent with the default variant of PrimaryButton. This will visually change the inverse variant to have a larger appearance when focused.
  • colors will no longer support the focusRing option:
    import {focusRing} from '@workday/canvas-kit-react/common';
    
    // before
    <PrimaryButton
      colors={{
        // other colors
        focus: {
          // other colors
        focusRing: focusRing(/* options */)
        }
      }}
    />
    
    // after
    <PrimaryButton
      colors={{
        // other colors
        focus: {
          // other colors
        }
      }}
      css={{
        ':focus-visible': focusRing(/* options */)
      }}
    />;

For the Reviewer

  • PR title is short and descriptive
  • PR summary describes the change (Fixes/Resolves linked correctly)
  • Breaking Changes provides useful information to upgrade to this code or removed if not applicable

Where Should the Reviewer Start?

/modules/react/button

@josh-bagwell josh-bagwell self-assigned this Jul 13, 2023
@josh-bagwell josh-bagwell changed the base branch from prerelease/major to prerelease/minor July 28, 2023 21:03
@josh-bagwell josh-bagwell changed the base branch from prerelease/minor to prerelease/major July 28, 2023 21:03
@josh-bagwell josh-bagwell added on hold PR is on hold until further notice and removed on hold PR is on hold until further notice labels Aug 8, 2023
@josh-bagwell josh-bagwell linked an issue Aug 11, 2023 that may be closed by this pull request
@josh-bagwell
Copy link
Contributor Author

image looks like icons action bar needs to be updated

Should we consider making this a test as well in the future? I wouldn't have noticed this without you mentioning it to me.

I had to reset a default iconPosition.

@josh-bagwell
Copy link
Contributor Author

In the PR toolbar icon button isn't filled: image What's in master is filled: image

This was a change we talked with design on. We decided that the icon shouldn't changed when toggled. This came up with segmented control on the tablet icon. It looks completely different so we decided to change it and not have it fill.

@mannycarrera4
Copy link
Contributor

In the PR toolbar icon button isn't filled: image What's in master is filled: image

This was a change we talked with design on. We decided that the icon shouldn't changed when toggled. This came up with segmented control on the tablet icon. It looks completely different so we decided to change it and not have it fill.

We should probably add this as change to the upgrade guide

@mannycarrera4
Copy link
Contributor

Focus seems to stay visible even after clicking the button.
Repo:

  1. Go to primary button storybook example
  2. Hit tab to focus the first button
  3. Click down on the first button
  4. Notice that the focus ring stays visible even after clicking with the mouse

Link

@mannycarrera4
Copy link
Contributor

mannycarrera4 commented Oct 18, 2023

I think we should update the CustomStyles storybook example to use Button and maybe an example or two using the cs prop and createStyles to show people how to override things assuming Button is exported

@NicholasBoll
Copy link
Member

Focus seems to stay visible even after clicking the button. Repo:

  1. Go to primary button storybook example
  2. Hit tab to focus the first button
  3. Click down on the first button
  4. Notice that the focus ring stays visible even after clicking with the mouse

Link

@mannycarrera4 We're no longer using the InputProvider to determine if the focus ring should be visible. That was our own heuristics. We're now using :focus-visible:

The :focus-visible pseudo-class applies while an element matches the :focus pseudo-class and the UA (User Agent) determines via heuristics that the focus should be made evident on the element. (Many browsers show a "focus ring" by default in this case.)

@mannycarrera4 mannycarrera4 removed the ready for review Code is ready for review label Oct 18, 2023
@mannycarrera4
Copy link
Contributor

EMOTIONAL DAMAGE

@josh-bagwell josh-bagwell changed the title feat: Button Styles Refactor chore: Refactored Button styles to use createStyles utility Oct 18, 2023
@alanbsmith alanbsmith merged commit 9a4ff36 into Workday:prerelease/major Oct 18, 2023
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Button Styles Refactor
4 participants