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

Migrate Button component to semantic color tokens #1881

Closed
wants to merge 2 commits into from

Conversation

robinmetral
Copy link
Contributor

🚧 POC 🚧

Depends on #1880

Purpose

For now, this is intended as a POC.

It migrates the Button component (quite color-heavy and used as an atom in many other components) to use semantic color tokens instead of the legacy theme.

Approach and changes

Describe how you solved the problem

Definition of done

  • Development completed
  • Reviewers assigned
  • Unit and integration tests
  • Meets minimum browser support
  • Meets accessibility requirements

@vercel
Copy link

vercel bot commented Dec 14, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
oss-circuit-ui ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 10, 2023 at 1:59PM (UTC)

@changeset-bot
Copy link

changeset-bot bot commented Dec 14, 2022

⚠️ No Changeset found

Latest commit: 175177e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@sumup-clark
Copy link

sumup-clark bot commented Dec 14, 2022

Hey @robinmetral,
we are super excited that you are contributing! 🎉There's one more thing you need to do. Please accept our Contributor License Agreement. It helps you and us to collaborate on clear terms and focus on what we love most: code.

Thanks!

@codecov
Copy link

codecov bot commented Dec 14, 2022

Codecov Report

Merging #1881 (175177e) into main (0085205) will decrease coverage by 0.02%.
The diff coverage is 90.90%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1881      +/-   ##
==========================================
- Coverage   91.70%   91.68%   -0.02%     
==========================================
  Files         172      172              
  Lines        3567     3572       +5     
  Branches     1198     1202       +4     
==========================================
+ Hits         3271     3275       +4     
- Misses        275      276       +1     
  Partials       21       21              
Impacted Files Coverage Δ
.../circuit-ui/components/ButtonGroup/ButtonGroup.tsx 100.00% <ø> (ø)
packages/circuit-ui/components/Button/Button.tsx 93.05% <90.90%> (-0.98%) ⬇️

@@ -157,34 +157,93 @@ const Content = styled.span<{ isLoading: boolean }>(
contentLoadingStyles,
);

const COLOR_MAP = {
const PRIMARY_COLOR_MAP = {
Copy link
Member

Choose a reason for hiding this comment

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

Now that we're using CSS variables, I'd refactor this code to move away from this object and replace it with a switch statement and explicit styles. Would help readability I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea! Just replaced the tokens for now, but you're right that this is a good opportunity to make this a bit clearer. Will address (in January)

Copy link
Member

Choose a reason for hiding this comment

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

Was contemplating this again and realized it's actually a matrix between variant and destructive. Would keep it for now and refactor with the new button design.

Base automatically changed from semantic-color-tokens to main January 10, 2023 14:11
@connor-baer connor-baer force-pushed the button-semantic-tokens branch from 4c4e479 to 175177e Compare February 10, 2023 13:57
kodiakhq bot pushed a commit that referenced this pull request Mar 1, 2023
* Add theme toggle

* Migrate Button component to semantic color tokens (#1881)

* Migrate Anchor component to semantic color tokens

* Migrate Avatar component to semantic color tokens

* Migrate Badge component to semantic color tokens

* Migrate Body component to semantic color tokens

* Migrate Card component to semantic color tokens

* Migrate Checkbox component to semantic color tokens

* Migrate field atoms to semantic color tokens

* Migrate Grid stories to semantic color tokens

* Migrate Header component to semantic color tokens

* Migrate Headline component to semantic color tokens

* Migrate Hr component to semantic color tokens

* Migrate ImageInput component to semantic color tokens

* Migrate InlineElements stories to semantic color tokens

* Migrate Input component to semantic color tokens

* Migrate ListItem component to semantic color tokens

* Migrate Modal component to semantic color tokens

* Migrate NotificationBanner component to semantic color tokens

* Migrate NotificationInline component to semantic color tokens

* Migrate NotificationModal component to semantic color tokens

* Migrate NotificationToast component to semantic color tokens

* Migrate Popover component to semantic color tokens

* Migrate ProgressBar component to semantic color tokens

* Migrate RadioButton component to semantic color tokens

* Migrate Select component to semantic color tokens

* Migrate SelectorGroup component to semantic color tokens

* Migrate Navigation components to semantic color tokens

* Migrate SidePanel component to semantic color tokens

* Migrate Skeleton component to semantic color tokens

* Migrate SubHeadline component to semantic color tokens

* Migrate Table component to semantic color tokens

* Migrate Tabs component to semantic color tokens

* Migrate Tag component to semantic color tokens

* Migrate Title component to semantic color tokens

* Migrate Toggle component to semantic color tokens

* Migrate Tooltip component to semantic color tokens

* Migrate BaseStyles to semantic color tokens

* Migrate Spinner stories to semantic color tokens

* Migrate Carousel component to semantic color tokens

* Migrate Storybook components to semantic color tokens

* Migrate Calendar components to semantic color tokens

* Migrate focusOutline style mixin to semantic color tokens

* Migrate focusVisible style mixin to semantic color tokens

* Migrate inputOutline style mixin to semantic color tokens

* Migrate listItem style mixin to semantic color tokens

* Migrate cx style mixin to semantic color tokens

* Change input outline to border/normal

* Update disabled styles for Button component

* Update disabled styles for Checkbox component

* Update disabled styles for ListItem component

* Update disabled styles for Navigation component

* Update disabled styles for Selector component

* Address review comments

* Update disabled styles for field atoms

* Update disabled styles for RadioButton component

* Deprecae the disableVisually style mixin

* Update rogue unit test

* Update disabled styles for Toggle component

* Lighten Toggle background

* Lighten Checkbox border

* Fix Checkbox disabled styles

* Fix bg/danger in Storybook theme

* Refactor theme switcher

* Disable dark theme for doc mode

* Tweak Storybook Icons page

* Add --cui-bg-elevated color

* Replace bg-normal by bg-elevated in components

* Remove unused imports from Icons page

* Fix Icons page default state

Co-authored-by: Connor Bär <[email protected]>

* Add changesets

* Add --cui-bg-elevated in blue.css and Storybook theme

* Redesign Avatar component (#1961)

* Redesign Avatar component

* Remove Avatar from accessibility tree when alt=''

This also improves the accessibility tests for the component.

* Make alt optional in Avatar

* Hide ImageInput underlying visual component from the accessibility tree

* Require alt in Avatar and remove from ImageInput

* Update ImageInput's  prop interface

* Use icon library asset for Avatar object variant

* Clean up unnecessary CSS

The icon size is set directly on the SVG assets coming from the icon library.

* Add changesets

---------

Co-authored-by: Robin Métral <[email protected]>

---------

Co-authored-by: Robin Métral <[email protected]>
@connor-baer
Copy link
Member

This PR was merged locally into #1944 and has been released as part of Circuit UI v6.3.

@connor-baer connor-baer deleted the button-semantic-tokens branch March 10, 2023 10:11
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.

2 participants