Skip to content

how to make my stories uses a ThemeProvider from "styled-components" #539

Discussion options

You must be logged in to vote

i found how to do it :

pnpm add --save-dev @react-theming/storybook-addon

// .storybook/main.js

module.exports = {
  stories: ['../src/**/*.stories.js'],
  addons: ['@react-theming/storybook-addon'],
};

then in preview.cjs

export const parameters = {
     actions: { argTypesRegex: "^on[A-Z].*" },
     controls: {
          matchers: {
               color: /(background|color)$/i,
               date: /Date$/,
          },
     },
};

import { ThemeProvider } from "styled-components";
import { withThemes } from "@react-theming/storybook-addon";

const theme = {
     color: "red",
};
// addDecorator is deprecated :
// https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#deprecate…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by tarik-gadoumi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant