-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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 #14652 from lauracarballo/fix-source-dynamic-snipp…
…et-includes-decorators Addon-docs: Exclude decorators in dynamic source snippets
- Loading branch information
Showing
7 changed files
with
106 additions
and
3 deletions.
There are no files selected for viewing
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
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
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
36 changes: 36 additions & 0 deletions
36
examples/cra-kitchen-sink/src/stories/decorators.stories.js
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,36 @@ | ||
import React from 'react'; | ||
import { action } from '@storybook/addon-actions'; | ||
import { Button } from '@storybook/react/demo'; | ||
import PropTypes from 'prop-types'; | ||
|
||
const Bold = ({ children }) => { | ||
return <b>{children}</b>; | ||
}; | ||
|
||
Bold.propTypes = { | ||
children: PropTypes.string.isRequired, | ||
}; | ||
|
||
export default { | ||
title: 'Decorators', | ||
component: Button, | ||
decorators: [ | ||
(Story) => ( | ||
<div style={{ padding: 25, border: '3px solid red' }}> | ||
<Story /> | ||
</div> | ||
), | ||
], | ||
}; | ||
|
||
export const WithArgs = (args) => <Button {...args} />; | ||
WithArgs.args = { onClick: action('clicked', { depth: 1 }), children: 'With args' }; | ||
|
||
export const Basic = () => <Button onClick={action('clicked', { depth: 1 })}>Basic</Button>; | ||
|
||
export const Nested = (args) => ( | ||
<Button {...args}> | ||
<Bold>Hello</Bold> | ||
</Button> | ||
); | ||
Nested.args = { onClick: action('clicked', { depth: 1 }) }; |
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
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
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