-
Notifications
You must be signed in to change notification settings - Fork 8
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
Support primary and accent variants for toggle and menu buttons #1934
Conversation
@msmithNI do you mind buddying this? |
change/@ni-nimble-components-083cf44c-68b4-43f6-b689-efd81c8228b4.json
Outdated
Show resolved
Hide resolved
## π€¨ Rationale I encountered a couple design tokens with names that felt inconsistent: `buttonFillActivePrimaryColor` `buttonFillAccentActiveColor` It seemed like the appearance variant ("accent" or "primary") should be in the same relative position within the name, but our naming convention dictated these names instead. ## π©βπ» Implementation Treat common state descriptors ("active", "disabled", "hover", and "selected") as a separate category of name segment than other distinguishing descriptors (like "accent" and "primary"). So instead of our old structure: `[element]-[part]-[state]-[token_type]` we now have: `[element]-[part]-[state]-[variant]-[token_type]` Luckily, the only existing token that violates this updated naming scheme is `buttonFillAccentActiveColor` (which should instead be `buttonFillActiveAccentColor`) and that token is being removed in [another PR](#1934). ## π§ͺ Testing N/A ## β Checklist - [x] I have updated the project documentation to reflect my changes or determined no changes are needed. --------- Co-authored-by: Milan Raj <[email protected]>
export const appearanceStates: [string, string | undefined][] = Object.entries( | ||
ButtonAppearance | ||
).map(([key, value]) => [pascalCase(key), value]); | ||
export type AppearanceState = (typeof appearanceStates)[number]; | ||
|
||
export const appearanceVariantStates: [string, string | undefined][] = Object.entries(ButtonAppearanceVariant).map(([key, value]) => [ | ||
pascalCase(key), | ||
value | ||
]); |
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.
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 just copied these as they were. I'll change them.
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'm approving just because I can.
# Pull Request ## π€¨ Rationale Makes the following bits more consistent in the storybook matrix tests: - All the states enums use the normal enum pattern ([instead of programmatic enum definition which looses some typing](#1934 (comment))) - All the states are defined first before the storybook metadata definition - All the states use the naming convention of `blahStates` for the state dimension and `BlahState` for the individual state type - File specific states were put in alphabetical order ## π©βπ» Implementation See above. ## π§ͺ Testing Should not result in any changes in stories except for one change in dialogs where I have the state name render on the page instead of the state value which is a long CSS string. ## β Checklist - [x] I have updated the project documentation to reflect my changes or determined no changes are needed. Hoping folks just copy and paste the patterns, didn't seem worth a doc update.
Pull Request
π€¨ Rationale
Fixes: #1906
π©βπ» Implementation
appearance-variant
attribute to both toggle and menu button.patterns/buttons/tests
.DigitalGreenDark
token value was incorrect, based on the Figma document. I updated this value, which affected block-accent button color and the rich-text mention font color.buttonFillActivePrimaryColor
andbuttonFillAccentActiveColor
.To avoid increasing the size of this PR, Angular/Blazor support will be added in a follow-up PR.
π§ͺ Testing
Lots of manual state styling testing in Storybook. Also Chromatic visual tests.
β Checklist