Add withMarkdownNotes to storybook__addon-notes

Adding the option from
https://github.com/storybooks/storybook/pull/2946/files
This commit is contained in:
Andrew MacLeay
2018-06-18 19:02:28 -04:00
parent 085e63ecf0
commit 48d8ca1650
2 changed files with 14 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
// Type definitions for @storybook/addon-notes 3.3
// Project: https://github.com/storybooks/storybook
// Definitions by: Joscha Feth <https://github.com/joscha>
// A.MacLeay <https://github.com/amacleay>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -8,6 +9,7 @@ import * as React from 'react';
import { RenderFunction } from '@storybook/react';
export function withNotes(textOrOptions: string | object): (getStory: RenderFunction) => RenderFunction;
export function withMarkdownNotes(text: string): (getStory: RenderFunction) => RenderFunction;
export interface WithNotesProps extends React.HTMLProps<HTMLDivElement> {
notes?: string;

View File

@@ -1,7 +1,13 @@
import * as React from 'react';
import { storiesOf } from '@storybook/react';
import { withNotes, WithNotes } from '@storybook/addon-notes';
import { withNotes, withMarkdownNotes, WithNotes } from '@storybook/addon-notes';
const SIMPLE_MARKDOWN = `
## Markdown for component
A very simple component with markdown notes
`;
storiesOf('Component', module)
.add('with some emoji', () => (
@@ -13,4 +19,9 @@ storiesOf('Component', module)
withNotes('A very simple component')(
() => (<div>my component</div>)
)
)
.add('with withMarkdownNotes',
withMarkdownNotes(SIMPLE_MARKDOWN)(
() => (<div>my component</div>)
)
);