Official-storybook: Add prop table example for multiple named exports

This commit is contained in:
Michael Shilman 2020-01-09 12:40:11 +08:00
parent 94adb10df4
commit 2d22ca81f5
2 changed files with 21 additions and 1 deletions

View File

@ -12,6 +12,25 @@ ButtonGroup.defaultProps = {
};
ButtonGroup.propTypes = {
/**
* Background color for the group
*/
background: PropTypes.string,
children: PropTypes.arrayOf(PropTypes.element),
};
/** SubGroup component description from docgen */
export const SubGroup = ({ background, children }) => <div style={{ background }}>{children}</div>;
SubGroup.defaultProps = {
background: '#0f0',
children: null,
};
SubGroup.propTypes = {
/**
* Background color for the sub-group
*/
background: PropTypes.string,
children: PropTypes.arrayOf(PropTypes.element),
};

View File

@ -9,7 +9,7 @@ import {
} from '@storybook/addon-docs/blocks';
import { DocgenButton } from '../../components/DocgenButton';
import BaseButton from '../../components/BaseButton';
import { ButtonGroup } from '../../components/ButtonGroup';
import { ButtonGroup, SubGroup } from '../../components/ButtonGroup';
export default {
title: 'Addons/Docs/stories docs blocks',
@ -131,6 +131,7 @@ multipleComponents.story = {
parameters: {
component: ButtonGroup,
subcomponents: {
SubGroup,
'Docgen Button': DocgenButton,
'Base Button': BaseButton,
},