Skip to content
This repository has been archived by the owner on May 2, 2023. It is now read-only.

feat(stories): Migration to CSF format - FRONT-1117 #489

Merged
merged 4 commits into from
Jul 3, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
module.exports = {
presets: ['@babel/preset-env', '@babel/preset-react'],
plugins: ['preval'],
plugins: [
[
'@babel/transform-runtime',
Copy link
Contributor

Choose a reason for hiding this comment

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

why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was needed for the script to migrate to run. But i have seen many times an error in the console for the missing regenerator-runtime in certain situations, so i thought that this would also be the way to fix that. Unfortunately i don't have "proof" about this, because i cannot reproduce the issue i described.
So if you think there are downsides of using this plugin we can remove it for now and reintegrate it only if we experience again the issue i mentioned.

Copy link
Contributor

Choose a reason for hiding this comment

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

For the script to run, ok. If it's not required after the work of the script and you're not sure about the benefits, I'd remove it, but it's up to you

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed it @kalinchernev ;)

{
regenerator: true,
},
],
'preval',
],
sourceType: 'unambiguous',
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"@babel/node": "7.10.1",
"@babel/preset-env": "7.10.2",
"@babel/preset-react": "7.10.1",
"@babel/plugin-transform-runtime": "^7.10.3",
"babel-jest": "24.9.0",
"babel-loader": "8.1.0",
"babel-plugin-preval": "4.0.0",
Expand Down
20 changes: 13 additions & 7 deletions src/ec/packages/ec-component-accordion/accordion.story.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { storiesOf } from '@storybook/html';
import { withKnobs, text, select, optionsKnob } from '@storybook/addon-knobs';
import { withNotes } from '@ecl-twig/storybook-addon-notes';
import {
Expand Down Expand Up @@ -46,10 +45,17 @@ const prepareAccordion = data => {
return data;
};

storiesOf('Components/deprecated/Accordion', module)
.addDecorator(withKnobs)
.addDecorator(withCode)
.addDecorator(withNotes)
.add('ECL < 2.6.0 - default', () => accordion(prepareAccordion(demoData)), {
export default {
title: 'Components/deprecated/Accordion',
decorators: [withKnobs, withCode, withNotes],
};

export const Default = () => accordion(prepareAccordion(demoData));

Default.story = {
name: 'ECL < 2.6.0 - default',

parameters: {
notes: { markdown: notes, json: demoData },
});
},
};
20 changes: 13 additions & 7 deletions src/ec/packages/ec-component-accordion2/accordion2.story.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { storiesOf } from '@storybook/html';
import { withKnobs, text, select, optionsKnob } from '@storybook/addon-knobs';
import { withNotes } from '@ecl-twig/storybook-addon-notes';
import {
Expand Down Expand Up @@ -45,10 +44,17 @@ const prepareAccordion2 = data => {
return data;
};

storiesOf('Components/Accordion2', module)
.addDecorator(withKnobs)
.addDecorator(withCode)
.addDecorator(withNotes)
.add('default', () => accordion2(prepareAccordion2(demoData)), {
export default {
title: 'Components/Accordion2',
decorators: [withKnobs, withCode, withNotes],
};

export const Default = () => accordion2(prepareAccordion2(demoData));

Default.story = {
name: 'default',

parameters: {
notes: { markdown: notes, json: demoData },
});
},
};
20 changes: 13 additions & 7 deletions src/ec/packages/ec-component-blockquote/blockquote.story.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { storiesOf } from '@storybook/html';
import { withKnobs, text } from '@storybook/addon-knobs';
import { withNotes } from '@ecl-twig/storybook-addon-notes';
import withCode from '@ecl-twig/storybook-addon-code';
Expand All @@ -23,10 +22,17 @@ const prepareQuote = data => {
return data;
};

storiesOf('Components/Blockquote', module)
.addDecorator(withKnobs)
.addDecorator(withCode)
.addDecorator(withNotes)
.add('default', () => blockquote(prepareQuote(defaultData)), {
export default {
title: 'Components/Blockquote',
decorators: [withKnobs, withCode, withNotes],
};

export const Default = () => blockquote(prepareQuote(defaultData));

Default.story = {
name: 'default',

parameters: {
notes: { markdown: notes, json: defaultData },
});
},
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { storiesOf } from '@storybook/html';
import { withNotes } from '@ecl-twig/storybook-addon-notes';
import { withKnobs, text, optionsKnob } from '@storybook/addon-knobs';
import withCode from '@ecl-twig/storybook-addon-code';
Expand Down Expand Up @@ -42,13 +41,27 @@ const prepareBreadcrumbCore = data => {
return data;
};

storiesOf('Components/Navigation/Breadcrumbs/Breadcrumb Core', module)
.addDecorator(withNotes)
.addDecorator(withCode)
.addDecorator(withKnobs)
.add('simple', () => breadcrumb(prepareBreadcrumbCore(dataSimple)), {
export default {
title: 'Components/Navigation/Breadcrumbs/Breadcrumb Core',
decorators: [withNotes, withCode, withKnobs],
};

export const Simple = () => breadcrumb(prepareBreadcrumbCore(dataSimple));

Simple.story = {
name: 'simple',

parameters: {
notes: { markdown: notes, json: dataSimple },
})
.add('long', () => breadcrumb(prepareBreadcrumbCore(dataLong)), {
},
};

export const Long = () => breadcrumb(prepareBreadcrumbCore(dataLong));

Long.story = {
name: 'long',

parameters: {
notes: { markdown: notes, json: dataLong },
});
},
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { storiesOf } from '@storybook/html';
import { withNotes } from '@ecl-twig/storybook-addon-notes';
import withCode from '@ecl-twig/storybook-addon-code';
import { withKnobs, text, optionsKnob } from '@storybook/addon-knobs';
Expand Down Expand Up @@ -42,13 +41,27 @@ const prepareBreadcrumbHarmonised = data => {
return data;
};

storiesOf('Components/Navigation/Breadcrumbs/Breadcrumb Harmonised', module)
.addDecorator(withNotes)
.addDecorator(withCode)
.addDecorator(withKnobs)
.add('simple', () => breadcrumb(prepareBreadcrumbHarmonised(dataSimple)), {
export default {
title: 'Components/Navigation/Breadcrumbs/Breadcrumb Harmonised',
decorators: [withNotes, withCode, withKnobs],
};

export const Simple = () => breadcrumb(prepareBreadcrumbHarmonised(dataSimple));

Simple.story = {
name: 'simple',

parameters: {
notes: { markdown: notes, json: dataSimple },
})
.add('long', () => breadcrumb(prepareBreadcrumbHarmonised(dataLong)), {
},
};

export const Long = () => breadcrumb(prepareBreadcrumbHarmonised(dataLong));

Long.story = {
name: 'long',

parameters: {
notes: { markdown: notes, json: dataLong },
});
},
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { storiesOf } from '@storybook/html';
import { withNotes } from '@ecl-twig/storybook-addon-notes';
import withCode from '@ecl-twig/storybook-addon-code';
import { withKnobs, text, optionsKnob } from '@storybook/addon-knobs';
Expand Down Expand Up @@ -42,13 +41,28 @@ const prepareBreadcrumbStandardised = data => {
return data;
};

storiesOf('Components/Navigation/Breadcrumbs/Breadcrumb Standardised', module)
.addDecorator(withNotes)
.addDecorator(withCode)
.addDecorator(withKnobs)
.add('simple', () => breadcrumb(prepareBreadcrumbStandardised(dataSimple)), {
export default {
title: 'Components/Navigation/Breadcrumbs/Breadcrumb Standardised',
decorators: [withNotes, withCode, withKnobs],
};

export const Simple = () =>
breadcrumb(prepareBreadcrumbStandardised(dataSimple));

Simple.story = {
name: 'simple',

parameters: {
notes: { markdown: notes, json: dataSimple },
})
.add('long', () => breadcrumb(prepareBreadcrumbStandardised(dataLong)), {
},
};

export const Long = () => breadcrumb(prepareBreadcrumbStandardised(dataLong));

Long.story = {
name: 'long',

parameters: {
notes: { markdown: notes, json: dataLong },
});
},
};
31 changes: 22 additions & 9 deletions src/ec/packages/ec-component-breadcrumb/breadcrumb.story.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { storiesOf } from '@storybook/html';
import { withKnobs, text, optionsKnob } from '@storybook/addon-knobs';
import { withNotes } from '@ecl-twig/storybook-addon-notes';
import withCode from '@ecl-twig/storybook-addon-code';
Expand Down Expand Up @@ -42,13 +41,27 @@ const prepareBreadcrumb = data => {
return data;
};

storiesOf('Components/Navigation/Breadcrumb', module)
.addDecorator(withKnobs)
.addDecorator(withNotes)
.addDecorator(withCode)
.add('simple', () => breadcrumb(prepareBreadcrumb(dataSimple)), {
export default {
title: 'Components/Navigation/Breadcrumb',
decorators: [withKnobs, withNotes, withCode],
};

export const Simple = () => breadcrumb(prepareBreadcrumb(dataSimple));

Simple.story = {
name: 'simple',

parameters: {
notes: { markdown: notes, json: dataSimple },
})
.add('long', () => breadcrumb(prepareBreadcrumb(dataLong)), {
},
};

export const Long = () => breadcrumb(prepareBreadcrumb(dataLong));

Long.story = {
name: 'long',

parameters: {
notes: { markdown: notes, json: dataLong },
});
},
};
Loading