Skip to content

Commit

Permalink
♻️ improve IconsDecorator usage to be less mandatory
Browse files Browse the repository at this point in the history
  • Loading branch information
Yago committed Jan 6, 2021
1 parent c5462ce commit 83378ca
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
12 changes: 2 additions & 10 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";

import Icons from '../src/components/atoms/Icons';
import { IconsDecorator } from '../src/components/atoms/Icons';
import '!style-loader!css-loader!./../build/styles.css';

export const parameters = {
Expand All @@ -19,13 +19,5 @@ export const parameters = {
}

export const decorators = [
(Story) => (
<>
<Story />{`
`}
<span hidden>👇 =========================== Icons sprite =========================== 👇</span>
<Icons />
</>
),
// IconsDecorator,
];
3 changes: 3 additions & 0 deletions src/components/atoms/Icon/Icon.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import React from 'react';

import { IconsDecorator } from '../Icons';

import Icon, { Props } from './Icon';

export default {
title: 'Atoms/Icon',
component: Icon,
decorators: [IconsDecorator],
};

const Template = (args: Props) => <Icon {...args} />;
Expand Down
13 changes: 13 additions & 0 deletions src/components/atoms/Icons/Icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,16 @@ const Icons = (): JSX.Element => (
);

export default Icons;

export const IconsDecorator = (Story: FunctionComponent): JSX.Element => (
<>
<Story />
{`
`}
<span hidden>
👇 =========================== Icons sprite =========================== 👇
</span>
<Icons />
</>
);
2 changes: 1 addition & 1 deletion src/components/atoms/Icons/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default } from './Icons';
export { default, IconsDecorator } from './Icons';

0 comments on commit 83378ca

Please sign in to comment.