-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9924 from storybookjs/9922-props-block-component-of
Props: Repro #9922
- Loading branch information
Showing
4 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
addons/docs/src/frameworks/react/__testfixtures__/9922-ts-component-props/docgen.snapshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`react component properties 9922-ts-component-props 1`] = ` | ||
"import React from 'react'; | ||
|
||
const Button = ({ | ||
children, | ||
onClick | ||
}) => React.createElement(\\"button\\", { | ||
onClick: onClick, | ||
type: \\"button\\" | ||
}, children); | ||
|
||
const WrappedButton = ({ | ||
spacing, | ||
...buttonProps | ||
}) => React.createElement(\\"div\\", { | ||
style: { | ||
padding: spacing | ||
} | ||
}, React.createElement(Button, buttonProps)); | ||
|
||
export const component = WrappedButton; | ||
WrappedButton.__docgenInfo = { | ||
\\"description\\": \\"\\", | ||
\\"methods\\": [], | ||
\\"displayName\\": \\"WrappedButton\\", | ||
\\"props\\": { | ||
\\"spacing\\": { | ||
\\"required\\": true, | ||
\\"tsType\\": { | ||
\\"name\\": \\"number\\" | ||
}, | ||
\\"description\\": \\"\\" | ||
} | ||
} | ||
};" | ||
`; |
23 changes: 23 additions & 0 deletions
23
addons/docs/src/frameworks/react/__testfixtures__/9922-ts-component-props/input.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React, { FunctionComponent, ComponentProps, HTMLAttributes } from 'react'; | ||
|
||
type Props = Pick<HTMLAttributes<HTMLButtonElement>, 'onClick'>; | ||
const Button: FunctionComponent<Props> = ({ children, onClick }) => ( | ||
<button onClick={onClick} type="button"> | ||
{children} | ||
</button> | ||
); | ||
|
||
type WrappedProps = { | ||
spacing: number; | ||
} & ComponentProps<typeof Button>; | ||
|
||
const WrappedButton: FunctionComponent<WrappedProps> = ({ | ||
spacing, | ||
...buttonProps | ||
}: WrappedProps) => ( | ||
<div style={{ padding: spacing }}> | ||
<Button {...buttonProps} /> | ||
</div> | ||
); | ||
|
||
export const component = WrappedButton; |
18 changes: 18 additions & 0 deletions
18
...ns/docs/src/frameworks/react/__testfixtures__/9922-ts-component-props/properties.snapshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`react component properties 9922-ts-component-props 1`] = ` | ||
Object { | ||
"rows": Array [ | ||
Object { | ||
"defaultValue": null, | ||
"description": "", | ||
"name": "spacing", | ||
"required": true, | ||
"type": Object { | ||
"detail": undefined, | ||
"summary": "number", | ||
}, | ||
}, | ||
], | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters