mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-17 00:05:59 +08:00
Merge branch 'next' of github.com:storybookjs/storybook into 20600-bug-storybook-docs-css-cascading-into-our-components
This commit is contained in:
commit
1ad7210a93
@ -80,15 +80,16 @@ export const render: ArgsStoryFn<VueRenderer> = (args, context) => {
|
||||
.filter((argType) => argType?.table?.category === 'events')
|
||||
.map((argType) => argType.name);
|
||||
|
||||
const camelCase = (str: string) => str.replace(/-([a-z])/g, (g) => g[1].toUpperCase());
|
||||
|
||||
if (eventProps.length) {
|
||||
eventsBinding = eventProps.map((name) => `@${name}="$props.${name}"`).join(' ');
|
||||
eventsBinding = `${eventsBinding} `;
|
||||
eventsBinding = eventProps.map((name) => `@${name}="$props['${camelCase(name)}']"`).join(' ');
|
||||
}
|
||||
|
||||
return {
|
||||
props: Object.keys(argTypes),
|
||||
components: { [componentName]: component },
|
||||
template: `<${componentName} ${eventsBinding}v-bind="filterOutEventProps($props)" />`,
|
||||
template: `<${componentName} ${eventsBinding} v-bind="filterOutEventProps($props)" />`,
|
||||
methods: {
|
||||
filterOutEventProps(props: object) {
|
||||
return Object.fromEntries(
|
||||
|
@ -19,8 +19,10 @@ export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Primary: Story = {
|
||||
backgroundColor: '#ff0',
|
||||
label: 'Button',
|
||||
args: {
|
||||
backgroundColor: '#ff0',
|
||||
label: 'Button',
|
||||
},
|
||||
};
|
||||
|
||||
export const Secondary: Story = {
|
||||
|
@ -18,8 +18,10 @@ export default meta;
|
||||
type Story = StoryObj<typeof Button>;
|
||||
|
||||
export const Primary: Story = {
|
||||
backgroundColor: '#ff0',
|
||||
label: 'Button',
|
||||
args: {
|
||||
backgroundColor: '#ff0',
|
||||
label: 'Button',
|
||||
},
|
||||
};
|
||||
|
||||
export const Secondary: Story = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user