Merge pull request #30518 from Vinnl/storybook__addon-links_react

Add type definition for the <LinkTo> component to @types/storybook__addons-links
This commit is contained in:
Benjamin Lichtman
2018-11-20 08:08:59 -08:00
committed by GitHub
3 changed files with 14 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
import * as React from 'react';
export default class LinkTo extends React.PureComponent<
React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement> &
{ story: string, kind?: string }
> {}
@@ -1,6 +1,7 @@
import * as React from 'react';
import { storiesOf } from '@storybook/react';
import { hrefTo, linkTo } from '@storybook/addon-links';
import LinkTo from '@storybook/addon-links/react';
storiesOf('Button', module)
.add('First', () => (
@@ -11,6 +12,9 @@ storiesOf('Button', module)
))
.add('With function', () => (
<button onClick={linkTo((arg1, arg2) => 'Button', () => 'First')}>Go to "First"</button>
))
.add('With <LinkTo> component', () => (
<LinkTo story="First" kind="Button"><button>Go to "First"</button></LinkTo>
));
hrefTo('Button', 'First').then(link => link);
@@ -17,6 +17,9 @@
"@storybook/addon-links": [
"storybook__addon-links"
],
"@storybook/addon-links/react": [
"storybook__addon-links/react"
],
"@storybook/react": [
"storybook__react"
]
@@ -27,6 +30,7 @@
},
"files": [
"index.d.ts",
"react.d.ts",
"storybook__addon-links-tests.tsx"
]
}