mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 14:27:04 +00:00
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:
+6
@@ -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"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user