-
Notifications
You must be signed in to change notification settings - Fork 40
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
Experience 8346: Add configuration for local instance of Storybook #8803
Conversation
aea92ef
to
5c14704
Compare
5c14704
to
5c90872
Compare
|
||
initializeWorker(); | ||
|
||
function withRestHooksCacheProvider(Story) { |
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.
We could add an all-in-one HOC like we do in tests, but I figure the granularity might be good. Not really an issue either way, though!
export const parameters = { | ||
actions: { argTypesRegex: "^on[A-Z].*" }, | ||
controls: { | ||
matchers: { |
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.
These are included by default on installation, but they're useful!
import "../src/content/generated/global.out.css"; | ||
|
||
// mock all dates in stories to make sure we don't run into date-related inconsistencies | ||
MockDate.set("2023-01-01"); |
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.
This'd be especially useful if we start using snapshots with Chromatic.
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 curious how this will interact with faker.js if we end up using it but something to worry about later.
options: { | ||
storySort: { | ||
method: "alphabetical", | ||
order: [], |
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 sure what the order should be yet since our component system is still in a limbo state.
}, | ||
}; | ||
|
||
initializeWorker(); |
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.
MSW isn't hooked up yet, but we might as well get it started 🤷
core: { | ||
builder: "@storybook/builder-webpack5", | ||
}, | ||
refs: { |
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.
Allows for composition with other/external Storybooks. Everything's still going through network requests so browsing external stories won't be as snappy as our own, but it's still nice to have everything in one place.
5c90872
to
8112f11
Compare
8112f11
to
a52b8ce
Compare
@stephenkao do we need a readme file for storybook that contains at the very least... |
@stephenkao do we want to include a markdown Introduction file describing an overview and the difference between our components and Trussworks and when to use one over the other? |
a52b8ce
to
51ed086
Compare
51ed086
to
2806447
Compare
My feeling is that Storybook documentation can happen as part of a separate ticket since it involves establishing guidelines and conventions as well. This changeset is specifically to get a local instance runnable so we can start to use it now as we're developing new changes. What are your thoughts about this? |
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.
LGTM
import "../src/content/generated/global.out.css"; | ||
|
||
// mock all dates in stories to make sure we don't run into date-related inconsistencies | ||
MockDate.set("2023-01-01"); |
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 curious how this will interact with faker.js if we end up using it but something to worry about later.
This changeset adds the initial configuration needed to spin up Storybook locally. It's incredibly simple right now, but it should include most addons that we need. Also included are very simple CSF examples for the StaticAlert and USLink components as a proof-of-concept. There's a known error with React 18 [here](storybookjs/storybook#17831 (comment)), but it shouldn't affect us for the time being. We could also install the bleeding-edge version of Storybook, but it looks like there are other issues with that as well -- so I recommend just sticking with the latest stable version until the next version is officially out.
2806447
to
93b95b4
Compare
SonarCloud Quality Gate failed. |
"@storybook/addon-links", | ||
"@storybook/addon-essentials", | ||
"@storybook/addon-interactions", | ||
"@storybook/addon-a11y", |
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 later, but this might be a really nice package to see the states of different components without the need of dev tools: https://storybook.js.org/addons/storybook-addon-pseudo-states
This changeset adds the initial configuration needed to spin up Storybook locally. It's incredibly simple right now, but it should include most addons that we need. Also included are very simple CSF examples for the StaticAlert and USLink components as a proof-of-concept.
There's a known error with React 18 here, but it shouldn't affect us for the time being. We could also install the bleeding-edge version of Storybook, but it looks like there are other issues with that as well -- so I recommend just sticking with the latest stable version until the next version is officially out.
Test Steps:
yarn install
to get latest dependenciesyarn run storybook
to run Storybook locallyChanges
Checklist
Testing
- [ ] Ran./prime test
or./gradlew testSmoke
against local Docker ReportStream container?npm run lint:write
?- [ ] Added tests?