Skip to content

Commit

Permalink
Manager part
Browse files Browse the repository at this point in the history
  • Loading branch information
kalinchernev committed Jan 27, 2020
1 parent 505673c commit c473639
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { withKnobs, text, array } from '@storybook/addon-knobs';
import demoContentCard from '@ecl/ec-specs-card/demo/data--card';
import demoContentTile from '@ecl/ec-specs-card/demo/data--tile';

import { Template } from './Template';
import { Template as template } from './Template';

import Card from '../src/Card';

Expand Down Expand Up @@ -97,4 +97,4 @@ storiesOf('Components|Card', module)

return <Card title={title} description={description} links={links} />;
})
.add('template', Template);
.add('template', template);
19 changes: 17 additions & 2 deletions src/systems/ec/implementations/react/storybook/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,22 @@ const addons = [
'@storybook/addon-viewport',
'@storybook/addon-a11y',
'@storybook/addon-cssresources',
// '../../../../../../tools/storybook-addon-code/register.jsx',
];

module.exports = { stories, addons };
const managerEntries = [
'../../../../../../src/tools/storybook-addon-code/register',
];

const managerWebpack = async baseConfig => {
// Babel loader: include "src"
baseConfig.module.rules[0].include.push(
path.resolve(__dirname, '../../../../../..')
);

// Exclude node_modules
baseConfig.module.rules[0].exclude = /node_modules/;

return baseConfig;
};

module.exports = { stories, addons, managerEntries, managerWebpack };
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { addDecorator, addParameters } from '@storybook/react';
import { withA11y } from '@storybook/addon-a11y';
import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport';
import { withCssResources } from '@storybook/addon-cssresources';
// import { withCode } from '../../../../../../tools/storybook-addon-code';
import { withCode } from '../../../../../../tools/storybook-addon-code';

import './ECL';

// addDecorator(withCode);
addDecorator(withCode);
addDecorator(withA11y);
addDecorator(withCssResources);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { withKnobs, text, array } from '@storybook/addon-knobs';
import demoContentCard from '@ecl/eu-specs-card/demo/data--card';
import demoContentTile from '@ecl/eu-specs-card/demo/data--tile';

import template from './Template';
import { Template as template } from './Template';

import Card from '../src/Card';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import demoContentTile from '@ecl/eu-specs-card/demo/data--tile';

import Card from '../src/Card';

const Template = () => {
// Storybook issues with modules' resolutions https://github.com/storybookjs/storybook/issues/9621
/* eslint-disable-next-line import/prefer-default-export */
export const Template = () => {
const image1 = {
alt: demoContentCard.image.alt,
src: demoContentCard.image.src,
Expand Down Expand Up @@ -97,5 +99,3 @@ const Template = () => {
</div>
);
};

export default Template;
21 changes: 19 additions & 2 deletions src/systems/eu/implementations/react/storybook/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const path = require('path');

const stories = [
'../../templates/**/*/stories/*.jsx',
'../../page-structure/**/*/stories/*.jsx',
Expand All @@ -12,7 +14,22 @@ const addons = [
'@storybook/addon-viewport',
'@storybook/addon-a11y',
'@storybook/addon-cssresources',
// '../../../../../../tools/storybook-addon-code/register.jsx',
];

module.exports = { stories, addons };
const managerEntries = [
'../../../../../../src/tools/storybook-addon-code/register',
];

const managerWebpack = async baseConfig => {
// Babel loader: include "src"
baseConfig.module.rules[0].include.push(
path.resolve(__dirname, '../../../../../..')
);

// Exclude node_modules
baseConfig.module.rules[0].exclude = /node_modules/;

return baseConfig;
};

module.exports = { stories, addons, managerEntries, managerWebpack };
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const theme = create({
colorSecondary: '#004494',
appBorderRadius: 0,
inputBorderRadius: 0,
brandTitle: 'ECL v2 - EC',
brandTitle: 'ECL v2 - EU',
brandUrl: 'https://github.com/ec-europa/europa-component-library',
brandImage: null,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
// Manually inject styles
var head = document.head || document.getElementsByTagName('head')[0];
head.appendChild(
createLink('./styles/ecl-ec-preset-legacy-website.css', 'screen')
createLink('./styles/ecl-eu-preset-legacy-website.css', 'screen')
);
head.appendChild(
createLink('./styles/ecl-ec-preset-legacy-website-print.css', 'print')
createLink('./styles/ecl-eu-preset-legacy-website-print.css', 'print')
);
}
</script>
<script
type="text/javascript"
src="./scripts/ecl-ec-preset-legacy-website.js"
src="./scripts/ecl-eu-preset-legacy-website.js"
></script>
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { addDecorator, addParameters } from '@storybook/react';
import { withA11y } from '@storybook/addon-a11y';
import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport';
import { withCssResources } from '@storybook/addon-cssresources';
// import { withCode } from '../../../../../../tools/storybook-addon-code';
import { withCode } from '../../../../../../tools/storybook-addon-code';

import './ECL';

// addDecorator(withCode);
addDecorator(withCode);
addDecorator(withA11y);
addDecorator(withCssResources);

Expand All @@ -21,12 +21,12 @@ addParameters({
cssresources: [
{
id: 'ecl-screen',
code: `<link rel="stylesheet" type="text/css" href="./styles/ecl-ec-preset-website.css" />`,
code: `<link rel="stylesheet" type="text/css" href="./styles/ecl-eu-preset-website.css" />`,
picked: true,
},
{
id: 'ecl-print',
code: `<link rel="stylesheet" type="text/css" href="./styles/ecl-ec-preset-website-print.css" />`,
code: `<link rel="stylesheet" type="text/css" href="./styles/ecl-eu-preset-website-print.css" />`,
picked: false,
},
{
Expand Down

0 comments on commit c473639

Please sign in to comment.