Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ShowCode): Ajoute la fonctionnalité Show Code de storybook addon-docs #124

Merged
merged 2 commits into from
May 11, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 7 additions & 0 deletions packages/storybook/.storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,19 @@ module.exports = {
{ loader: 'sass-loader' }
]
},
{
test: /\.stories.tsx?$/,
use: [{ loader: '@storybook/source-loader' }],
enforce: 'pre',
include: path.resolve(__dirname, '../stories')
},
{
test: /\.tsx?$/,
use: [{
loader: 'ts-loader',
options: {
transpileOnly: false,
ignoreDiagnostics: [7005]
Copy link
Contributor

Choose a reason for hiding this comment

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

T'as essayé de mettre à jour storybook à la place? La dernière c'est 5.3.18 et il y a l'air d'avoir quelques références à ça dans les versions patch de 5.3

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Je viens d'essayer et ça enable pas le showcode seulement en faisant l'update. L'update à 5.3 est dans le backlog JIRA, ça devrait donc être fait prochainement avec l'ajout des fonctionnalités intéressantes.

}
}],
},
Expand Down
39 changes: 17 additions & 22 deletions packages/storybook/stories/buttons/add-button.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,59 +1,54 @@
import React from 'react';

import { AddButton } from '@equisoft/design-elements-react';

type ButtonType = 'primary' | 'secondary' | 'tertiary';
import React from 'react';

export default {
title: 'Buttons/Add',
component: AddButton,
};

export const addButtons = () => (
<div>
<>
<AddButton
label="Primary"
buttonType={'primary' as ButtonType}
buttonType="primary"
disabled={false}
/>
<AddButton
label="Secondary"
buttonType={'secondary' as ButtonType}
buttonType="secondary"
disabled={false}
/>
<AddButton
label="Tertiary"
buttonType={'tertiary' as ButtonType}
buttonType="tertiary"
disabled={false}
/>
</div>
</>
);
export const disabled = () => (
<div>
<>
<AddButton
label="Primary"
buttonType={'primary' as ButtonType}
buttonType="primary"
disabled={true}
/>
<AddButton
label="Secondary"
buttonType={'secondary' as ButtonType}
buttonType="secondary"
disabled={true}
/>
<AddButton
label="Tertiary"
buttonType={'tertiary' as ButtonType}
buttonType="tertiary"
disabled={true}
/>
</div>
</>
);
export const eventCallback = () => (
<div>
<AddButton
label="See Console For Callback"
buttonType={'primary' as ButtonType}
onClick={() => { console.log('The button has been clicked!'); }}
disabled={false}
/>
</div>
<AddButton
label="See Console For Callback"
buttonType="primary"
onClick={() => { console.log('The button has been clicked!'); }}
disabled={false}
/>
);
39 changes: 17 additions & 22 deletions packages/storybook/stories/buttons/buttons.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,30 @@
import React from 'react';

import { Button } from '@equisoft/design-elements-react';

type ButtonType = 'primary' | 'secondary' | 'tertiary';
import React from 'react';

export default {
title: 'Buttons',
component: Button,
};

export const buttons = () => (
<div>
<Button label="Primary" buttonType={'primary' as ButtonType} disabled={false} />
<Button label="Secondary" buttonType={'secondary' as ButtonType} disabled={false} />
<Button label="Tertiary" buttonType={'tertiary' as ButtonType} disabled={false} />
</div>
<>
<Button label="Primary" buttonType="primary" disabled={false} />
<Button label="Secondary" buttonType="secondary" disabled={false} />
<Button label="Tertiary" buttonType="tertiary" disabled={false} />
</>
);
export const disabled = () => (
<div>
<Button label="Primary" buttonType={'primary' as ButtonType} disabled={true} />
<Button label="Secondary" buttonType={'secondary' as ButtonType} disabled={true} />
<Button label="Tertiary" buttonType={'tertiary' as ButtonType} disabled={true} />
</div>
<>
<Button label="Primary" buttonType="primary" disabled={true} />
<Button label="Secondary" buttonType="secondary" disabled={true} />
<Button label="Tertiary" buttonType="tertiary" disabled={true} />
</>
);
export const eventCallback = () => (
<div>
<Button
label="See Console For Callback"
onClick={() => { console.log('The button has been clicked!'); }}
buttonType={'primary' as ButtonType}
disabled={false}
/>
</div>
<Button
label="See Console For Callback"
onClick={() => { console.log('The button has been clicked!'); }}
buttonType="primary"
disabled={false}
/>
);
14 changes: 6 additions & 8 deletions packages/storybook/stories/buttons/icon-button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ export const disabled = () => (
</>
);
export const eventCallback = () => (
<>
<IconButton
label="home"
iconName="home"
onClick={() => { console.log('The button has been clicked!'); }}
buttonType={'primary'}
/>
</>
<IconButton
label="home"
iconName="home"
onClick={() => { console.log('The button has been clicked!'); }}
buttonType={'primary'}
/>
);
2 changes: 1 addition & 1 deletion packages/storybook/stories/card.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {

export const normal = () => (
<Card>Hello, World!</Card>
);
);
14 changes: 6 additions & 8 deletions packages/storybook/stories/theme-wrapper.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import React from 'react';

import { Button, testTheme, ThemeWrapper } from '@equisoft/design-elements-react';

type ButtonType = 'primary' | 'secondary' | 'tertiary';

export default {
title: 'Theme Wrapper',
component: ThemeWrapper,
Expand All @@ -14,16 +12,16 @@ export const normal = () => (
<ThemeWrapper theme={testTheme}>
<div>
<h3 style={{ marginTop: '0' }} >With wrapper (test theme)</h3>
<Button label="Primary" buttonType={'primary' as ButtonType} disabled={false} />
<Button label="Secondary" buttonType={'secondary' as ButtonType} disabled={false} />
<Button label="Tertiary" buttonType={'tertiary' as ButtonType} disabled={false} />
<Button label="Primary" buttonType="primary" disabled={false} />
<Button label="Secondary" buttonType="secondary" disabled={false} />
<Button label="Tertiary" buttonType="tertiary" disabled={false} />
</div>
</ThemeWrapper>
<div>
<h3>Without wrapper (default Equisoft theme)</h3>
<Button label="Primary" buttonType={'primary' as ButtonType} disabled={false} />
<Button label="Secondary" buttonType={'secondary' as ButtonType} disabled={false} />
<Button label="Tertiary" buttonType={'tertiary' as ButtonType} disabled={false} />
<Button label="Primary" buttonType="primary" disabled={false} />
<Button label="Secondary" buttonType="secondary" disabled={false} />
<Button label="Tertiary" buttonType="tertiary" disabled={false} />
</div>
</>
);
1 change: 0 additions & 1 deletion packages/storybook/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"esModuleInterop": true,
"jsx": "react",
"allowSyntheticDefaultImports": true,
"noEmitOnError": true,
"sourceMap": true,
"baseUrl": "./stories/",
"paths": {
Expand Down