Skip to content

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

Merged
merged 15 commits into from
Sep 24, 2024
Merged

Merge S1 and S2 chromatic storybooks #6965

merged 15 commits into from
Sep 24, 2024

Conversation

LFDanLu
Copy link
Member

@LFDanLu LFDanLu commented Aug 27, 2024

Closes

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

🧢 Your Project:

@rspbot
Copy link

rspbot commented Aug 27, 2024

@LFDanLu LFDanLu changed the title (WIP) Merge S1 and S2 chromatic storybooks Merge S1 and S2 chromatic storybooks Aug 28, 2024
@rspbot
Copy link

rspbot commented Aug 28, 2024

@rspbot
Copy link

rspbot commented Aug 28, 2024

@rspbot
Copy link

rspbot commented Aug 30, 2024

@LFDanLu
Copy link
Member Author

LFDanLu commented Aug 30, 2024

https://www.chromatic.com/build?appId=5f0dd5ad2b5fc10022a2e320&number=774 Standard chromatic
https://www.chromatic.com/build?appId=651b502f6b74abaae4ee734c&number=38 HCM chromatic

take a look at the results, happy for opinions. I've failed several of the stories, will fix/make followup tickets later

Comment on lines +6 to +7
// TODO: can't seem to use the style macro here...
// import {style} from '../../../packages/@react-spectrum/s2/style/spectrum-theme' with {type: 'macro'};
Copy link
Member Author

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

Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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

@LFDanLu LFDanLu marked this pull request as ready for review August 30, 2024 18:09
@rspbot
Copy link

rspbot commented Aug 30, 2024

reidbarber
reidbarber previously approved these changes Aug 30, 2024
@rspbot
Copy link

rspbot commented Sep 5, 2024

}
});

function RenderS2({getStory, context, options, selectedLocales, height, minHeight}) {
Copy link
Member

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.

Copy link
Member Author

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

@rspbot
Copy link

rspbot commented Sep 9, 2024

@@ -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}
Copy link
Member Author

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

@rspbot
Copy link

rspbot commented Sep 9, 2024

was only needed to try and fix font rendering oddness
@rspbot
Copy link

rspbot commented Sep 17, 2024

snowystinger
snowystinger previously approved these changes Sep 18, 2024
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
Copy link
Member

Choose a reason for hiding this comment

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

Can remove todo

@adobe adobe deleted a comment from rspbot Sep 18, 2024
* 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
@rspbot
Copy link

rspbot commented Sep 23, 2024

@adobe adobe deleted a comment from rspbot Sep 23, 2024
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
Copy link
Member

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?

Copy link
Member

@yihuiliao yihuiliao Sep 23, 2024

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}
Copy link
Member

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.

Copy link
Member

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}) => {
Copy link
Member

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?

Copy link
Member

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;
Copy link
Member

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?

Copy link
Member

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

@rspbot
Copy link

rspbot commented Sep 24, 2024

Copy link
Member

@snowystinger snowystinger left a 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

@snowystinger snowystinger merged commit 5a0b4fa into main Sep 24, 2024
31 checks passed
@snowystinger snowystinger deleted the combine_chromatic branch September 24, 2024 00:45
@snowystinger
Copy link
Member

This changed no source files, so merged, we can iterate on it now and catch regressions

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.

6 participants