mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-20 05:02:37 +08:00
ArgsTable: Add warning when subcomponents is an array
This commit is contained in:
parent
210bd62343
commit
4b5f29b3fc
@ -193,6 +193,11 @@ export const StoryTable: FC<
|
||||
}
|
||||
|
||||
if (subcomponents) {
|
||||
if (Array.isArray(subcomponents)) {
|
||||
throw new Error(
|
||||
`Unexpected subcomponents array. Expected an object whose keys are tab labels and whose values are components.`
|
||||
);
|
||||
}
|
||||
tabs = addComponentTabs(tabs, subcomponents, context, include, exclude);
|
||||
}
|
||||
return <TabbedArgsTable tabs={tabs} />;
|
||||
|
@ -0,0 +1,10 @@
|
||||
import React from 'react';
|
||||
import Button from '../../components/TsButton';
|
||||
|
||||
export default {
|
||||
title: 'Addons/Docs/Subcomponents array',
|
||||
component: Button,
|
||||
subcomponents: [Button],
|
||||
};
|
||||
|
||||
export const Basic = () => <Button>Bad subcomponents</Button>;
|
Loading…
x
Reference in New Issue
Block a user