Skip to content

Commit 5f7037d

Browse files
authored
feat(storybook): move config folder to root (#2267)
1 parent a031728 commit 5f7037d

23 files changed

+1127
-1255
lines changed

.github/workflows/testing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
with:
3434
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
3535
buildScriptName: ci:storybook
36-
storybookConfigDir: tools/preview
36+
storybookConfigDir: .storybook
3737
exitOnceUploaded: true
3838
onlyChanged: true
3939
traceChanged: true

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ package-lock.json
1717
.nx
1818

1919
# Storybook build output
20-
tools/preview/storybook-static
20+
.storybook/storybook-static
2121
build-storybook.log
2222

2323
# Chromatic

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ components/expressvars/css/**/*.css
99
components/vars/css/**/*.css
1010
components/vars/custom.css
1111
components/tokens/custom-*/*.css
12-
tools/preview/storybook-static/**
12+
.storybook/storybook-static/**
1313
generator
1414
dist
1515
template.hbs
File renamed without changes.
File renamed without changes.
File renamed without changes.

tools/preview/README.md renamed to .storybook/README.md

Lines changed: 82 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ Storybook leverages webpack for bundling and we have updated it with the followi
5050

5151
```js
5252
try {
53-
if (!express) import(/* webpackPrefetch: true */ "../themes/spectrum.css");
54-
else import(/* webpackPrefetch: true */ "../themes/express.css");
53+
if (!express) import(/* webpackPrefetch: true */ "../themes/spectrum.css");
54+
else import(/* webpackPrefetch: true */ "../themes/express.css");
5555
} catch (e) {
56-
console.warn(e);
56+
console.warn(e);
5757
}
5858
```
5959

@@ -249,73 +249,73 @@ import "../index.css";
249249

250250
// More on component templates: https://storybook.js.org/docs/web-components/writing-stories/introduction#using-args
251251
export const Template = ({
252-
rootClass = "spectrum-Tag",
253-
size = "m",
254-
iconName,
255-
avatarUrl,
256-
label,
257-
isSelected = false,
258-
isEmphasized = false,
259-
isDisabled = false,
260-
isInvalid = false,
261-
hasClearButton = false,
262-
id,
263-
customClasses = [],
264-
...globals
252+
rootClass = "spectrum-Tag",
253+
size = "m",
254+
iconName,
255+
avatarUrl,
256+
label,
257+
isSelected = false,
258+
isEmphasized = false,
259+
isDisabled = false,
260+
isInvalid = false,
261+
hasClearButton = false,
262+
id,
263+
customClasses = [],
264+
...globals
265265
}) => {
266-
const { express } = globals;
267-
268-
try {
269-
if (!express) import(/* webpackPrefetch: true */ "../themes/spectrum.css");
270-
else import(/* webpackPrefetch: true */ "../themes/express.css");
271-
} catch (e) {
272-
console.warn(e);
273-
}
274-
275-
return html`
276-
<div
277-
class=${classMap({
278-
[rootClass]: true,
279-
[`${rootClass}--size${size?.toUpperCase()}`]:
280-
typeof size !== "undefined",
281-
"is-emphasized": isEmphasized,
282-
"is-disabled": isDisabled,
283-
"is-invalid": isInvalid,
284-
"is-selected": isSelected,
285-
...customClasses.reduce((a, c) => ({ ...a, [c]: true }), {}),
286-
})}
287-
id=${ifDefined(id)}
288-
tabindex="0"
289-
>
290-
${avatarUrl && !iconName
291-
? Avatar({
292-
...globals,
293-
image: avatarUrl,
294-
size: "50",
295-
})
296-
: ""} ${iconName
297-
? Icon({
298-
...globals,
299-
iconName,
300-
customClasses: [`${rootClass}s-itemIcon`],
301-
})
302-
: ""}
303-
<span class="${rootClass}s-itemLabel">${label}</span>
304-
${hasClearButton
305-
? ClearButton({
306-
...globals,
307-
customClasses: [`${rootClass}-clearButton`],
308-
onclick: (evt) => {
309-
const el = evt.target;
310-
if (!el) return;
311-
312-
const wrapper = el.closest(rootClass);
313-
wrapper.parentNode.removeChild(wrapper);
314-
},
315-
})
316-
: ""}
317-
</div>
318-
`;
266+
const { express } = globals;
267+
268+
try {
269+
if (!express) import(/* webpackPrefetch: true */ "../themes/spectrum.css");
270+
else import(/* webpackPrefetch: true */ "../themes/express.css");
271+
} catch (e) {
272+
console.warn(e);
273+
}
274+
275+
return html`
276+
<div
277+
class=${classMap({
278+
[rootClass]: true,
279+
[`${rootClass}--size${size?.toUpperCase()}`]:
280+
typeof size !== "undefined",
281+
"is-emphasized": isEmphasized,
282+
"is-disabled": isDisabled,
283+
"is-invalid": isInvalid,
284+
"is-selected": isSelected,
285+
...customClasses.reduce((a, c) => ({ ...a, [c]: true }), {}),
286+
})}
287+
id=${ifDefined(id)}
288+
tabindex="0"
289+
>
290+
${avatarUrl && !iconName
291+
? Avatar({
292+
...globals,
293+
image: avatarUrl,
294+
size: "50",
295+
})
296+
: ""} ${iconName
297+
? Icon({
298+
...globals,
299+
iconName,
300+
customClasses: [`${rootClass}s-itemIcon`],
301+
})
302+
: ""}
303+
<span class="${rootClass}s-itemLabel">${label}</span>
304+
${hasClearButton
305+
? ClearButton({
306+
...globals,
307+
customClasses: [`${rootClass}-clearButton`],
308+
onclick: (evt) => {
309+
const el = evt.target;
310+
if (!el) return;
311+
312+
const wrapper = el.closest(rootClass);
313+
wrapper.parentNode.removeChild(wrapper);
314+
},
315+
})
316+
: ""}
317+
</div>
318+
`;
319319
};
320320
```
321321
@@ -325,7 +325,7 @@ Now that your stories are written, we need to add them to our visual regression
325325
326326
### Getting started
327327
328-
Check that you have a local `.env` file in your `tools/preview` folder with a `CHROMATIC_PROJECT_TOKEN` variable defined. Get this token from the project maintainer. You should not be committing this `.env` file to the repo as it contains sensitive login information.
328+
Check that you have a local `.env` file in your `.storybook` folder with a `CHROMATIC_PROJECT_TOKEN` variable defined. Get this token from the project maintainer. You should not be committing this `.env` file to the repo as it contains sensitive login information.
329329
330330
From the root of the project, there are 2 commands available for you to run:
331331
@@ -339,16 +339,15 @@ Runs will generate a JUnit XML file with build results (`chromatic-build-{buildN
339339
340340
Running without publishing to Chromatic? Add the `--dry-run` flag. Need more information to debug a run? Try the `--diagnostics` flag (writes process context information to `chromatic-diagnostics.json`).
341341
342-
343-
344342
# Migration to Storybook 7.0(Draft)
345343
344+
## Updates
346345
347-
## Updates:
348346
---
349347
`*` Added support for handler actions with ```withActions``` on each stories which have action handlers.
350348
351349
Example:
350+
352351
```js
353352
import globalThis from 'global';
354353
+ import { withActions } from '@storybook/addon-actions/decorator';
@@ -373,6 +372,7 @@ export const Basic = {
373372
`*` Upgraded to ```Webpack 5``` for improved bundling and performance from ```webpack 4```
374373
375374
`*` @storybook addons dependencies are upgraded to v7 from v6
375+
376376
```js
377377
"@storybook/addon-docs": "^7.0.12",
378378
"@storybook/addon-essentials": "^7.0.12",
@@ -393,9 +393,10 @@ export const Basic = {
393393
394394
`*` Improved the addon ecosystem with new and updated addons.
395395
396-
397396
<br></br>
398-
## Breaking Changes:
397+
398+
## Breaking Changes
399+
399400
---
400401
`*` client-api is deperacted and preview-api is introduced
401402
@@ -426,6 +427,7 @@ export const Basic = {
426427
```
427428
428429
`*` Docs is now added to every component on the sidebar with the below code in Storybook 7
430+
429431
```js
430432
docs: {
431433
autodocs: true,
@@ -446,24 +448,26 @@ export const Basic = {
446448
+ },
447449
+ };
448450
```
449-
## Deprecations(Addons):
451+
452+
## Deprecations(Addons)
453+
450454
---
451455
452456
`*` ```"@storybook/client-api"``` is deprecated
453457
454458
`*` ```"@storybook/addons"``` is deprecated
455459
460+
## Bug Fixes
456461
457-
## Bug Fixes:
458462
---
459463
`*` Fixed various issues related to performance, rendering, and compatibility.
460464
461465
`*` Resolved problems with the Storybook UI, including layout glitches and navigation bugs.
462466
463467
`*` Fixed bugs in calender storybook
464468
469+
## Improvements
465470
466-
## Improvements:
467471
---
468472
`*` Improved the overall performance and stability of the Storybook development environment.
469473
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)