我对故事书和打字稿都很陌生,在创建一个采用两个参数 Story 和 context 的装饰器时,我陷入了困境。
const CustomDecorator = (Story, context) => {
console.log("My Decorator");
return (
<Story />
);
};
const preview: Preview = {
decorators: [CustomDecorator],
parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
globalTypes: {
theme: {
description: 'Global theme for components',
defaultValue: 'light',
toolbar: {
// The label to show for this toolbar item
title: 'Theme',
icon: 'circlehollow',
// Array of plain string values or MenuItem shape …Run Code Online (Sandbox Code Playgroud)