import React from 'react'; import centered from '@storybook/addon-centered/react'; import { storiesOf } from '@storybook/react'; import importAll from '../../src/utils/importAll'; import parsePathToName from '../../src/utils/parsePathToName'; import ColumnsLayout from '../../src/components/ColumnsLayout'; const backgroundsList = require.context('../../src/assets/background', false, /\.(png|jpe?g|svg)$/); const backgrounds = importAll(backgroundsList); const stories = storiesOf('Assets|Backgrounds', module); stories.addDecorator(centered); stories.addParameters({ backgrounds: [{ name: 'silver', value: '#cacaca', default: true }], }); stories.add('_all', () => { return ( {backgrounds.map((background, i) => { return ( {parsePathToName(backgroundsList.keys()[i])} ); })} ); }); backgrounds.forEach((background, i) => { stories.add(`${parsePathToName(backgroundsList.keys()[i])}`, () => ( )); });
{parsePathToName(backgroundsList.keys()[i])}