-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Merge S1 and S2 chromatic storybooks #6965
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
Conversation
also make s2 appear last in chromatic storybook
https://www.chromatic.com/build?appId=5f0dd5ad2b5fc10022a2e320&number=774 Standard chromatic take a look at the results, happy for opinions. I've failed several of the stories, will fix/make followup tickets later |
// TODO: can't seem to use the style macro here... | ||
// import {style} from '../../../packages/@react-spectrum/s2/style/spectrum-theme' with {type: 'macro'}; |
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.
Not exactly sure why the macro doesn't work here, ideally I'd use if for some of the divs below
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.
can't import directly from @react-spectrum/s2
either? instead of the relative path?
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.
yep, doing that returns an error of
@parcel/transformer-js: Error loading macro: Could not resolve module "@react-spectrum/s2/style" from
"/Users/danilu/dev/react-spectrum/.chromatic/custom-addons/chromatic/index.js"
The relative path way returns an error of
@parcel/core: Failed to resolve '0' from './.chromatic/custom-addons/chromatic/index.js'
@parcel/resolver-default: Cannot find module '0'
I haven't had time to dig into too deeply but its not a huge deal IMO since it is just some padding/div wrappers for story layout
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.
o, maybe this is loaded through another bundler, storybook UI has one vs the one used for stories
} | ||
}); | ||
|
||
function RenderS2({getStory, context, options, selectedLocales, height, minHeight}) { |
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.
Could you make this into a shared component that .chromatic-fc and .chromatic both use? I assume there is no way you could make this general enough to make it not specific to s2 or RSPv3, the s2 or RSP3 parts are passed in, or toggles between them based on a property? It's just a big ugly block of code getting repeated. It's probably not worth the effort to refactor it this way.
As part of this, I was wondering if making it a component would move the style macro import out of this file and into another file where it might work.
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.
for now I'll leave it as its own block until I figure out the full set of differences when I add the powerset prop combination stories for s2, but yeah it would be nice to unify this
@@ -17,13 +17,15 @@ import {style} from '../style/spectrum-theme' with {type: 'macro'}; | |||
const meta: Meta<typeof Checkbox> = { | |||
component: Checkbox, | |||
parameters: { | |||
layout: 'centered' | |||
layout: 'centered', | |||
chromatic: {delay: 10000} |
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.
Note: will remove this delay soon, just added as part of Chromatic support debugging for S2 font vertical centering
was only needed to try and fix font rendering oddness
let colorSchemes = options.colorSchemes || S2ColorThemes; | ||
let backgrounds = options.backgrounds || ['base']; | ||
|
||
// TODO: there is perhaps some things that can still be shared between the two renders but figured it be easiest to just split them out for the most part |
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.
Can remove todo
* add play functions to s2 chromatic overlay stories * move overlay chromatic stories into separate stories this is because we can only have one overay open at a time and so the open overlay doesnt cover the other elements in the main chromatic stories * add RTL and dark theme stories for overlay chromatics stories * add more power set stories and fix lint * fix chromatic error * fix lint and add button + checkbox powersets * add colorarea,field and reusue shortName * Add colorslider, add contextual help, and use original stories in chromatic ones if needed * split up powersets that were too big * ugh lint * adding data-testids and other review comments
export const Dynamic = Many as StoryObj; | ||
|
||
Dynamic.parameters = { | ||
// TODO: move these options back to meta above once we get strings for ar-AE. This is just to prevent the RTL story's config from actually applying |
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.
Do we have translations since we're about to release?
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.
as far as i know, i don't think we've gotten the translations for breadcrumbs yet
parameters: { | ||
layout: 'centered' | ||
} | ||
chromaticProvider: {colorSchemes: ['dark'], backgrounds: ['base'], locales: ['ar-AE'], disableAnimations: true} |
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.
Do these props or the Powerset export's props win? I'm trying to figure out why the colorSchemes and locales don't seem consistent in the Beardcrumb and BreadcrumbRTL stories.
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 not 100% sure but i think these props win. this comment from daniel might be helpful
|
||
export const Default = {...Example}; | ||
|
||
Default.play = async ({canvasElement}) => { |
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.
Do we plan to have submenu stories via "play" too?
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.
Yep, daniel and i have a canvas tracking what things we'd like to add. figured we get this in and i can work on adding additional s2 chromatic stories separately as follow-up
|
||
export default meta; | ||
|
||
export const Default = Example as StoryObj; |
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 guess we can't do powersets, but can we manually check the tooltip directions?
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.
oh yeah, i think that would be a good idea. i'll add it to the canvas to track
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.
Notes for follow-up
https://www.chromatic.com/test?appId=5f0dd5ad2b5fc10022a2e320&id=66f207aebe7f86d8a2172645 dialog stories need some fixing, I don't know what I'm looking at here
this story is broken, might need a fix in TagGroup
https://www.chromatic.com/test?appId=5f0dd5ad2b5fc10022a2e320&id=66f207aebe7f86d8a21725e1
This changed no source files, so merged, we can iterate on it now and catch regressions |
Closes
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: