Détail du package

storybook-addon-styled-component-theme

echoulen105.7kMIT2.0.0

storybook addon with styled-components theme

storybook, styled-component, addon, theme

readme

npm version build status codecov

This addon allows storybook to showcase components with multiple different styled-component themes. Supports storybook v4, v5, v6 and newer

Installation

yarn add storybook-addon-styled-component-theme --dev

Configuration

storybook v6

Add a decorator to stories in .storybook/preview.js


import { addDecorator } from "@storybook/react";
import { withThemesProvider } from "storybook-addon-styled-component-theme";
import { ThemeProvider } from "styled-components";

const themes = [theme1, theme2];
addDecorator(withThemesProvider(themes), ThemeProvider);

Add to .storybook/main.js

module.exports = {
  ...
  addons: [
    ...
    "storybook-addon-styled-component-theme/dist/preset"
  ]
};

storybook v5 and v4

Add to .storybook/addons.js

// v1.3, storybook v5.2
import "storybook-addon-styled-component-theme/dist/register";

// v1.2, storybook v4, v5.0
import "storybook-addon-styled-component-theme/dist/src/register";

addDecorator to .storybook/preview.js

import { addDecorator } from "@storybook/react";
import { withThemesProvider } from "storybook-addon-styled-component-theme";

const themes = [theme1, theme2];
addDecorator(withThemesProvider(themes));

Remind

Make sure every theme object has a name property

Contributing

Build local library
yarn

yarn build
Start the local example
cd example

yarn

yarn storybook

Run all the spec

yarn test

changelog

Change Log

v1.2.0 (2019-04-07)

Full Changelog

Closed issues:

  • This addon removes function from the theme object #17
  • Storybook v5 button display issue #15
  • The absense of CHANGELOG.md #12

v1.1.1 (2019-01-11)

Full Changelog

Implemented enhancements:

  • Remember theme selection #10

Closed issues:

  • switch themes doesn't work with default props #9
  • Theme Object Is Altered #8
  • Emotion support #2

v1.1.0 (2018-11-05)

Full Changelog

Closed issues:

  • Themes showing up in every addon tab #7
  • Theme selection button set to 'serif' #5
  • use this addon for angular 6+ apps #4

Merged pull requests:

v1.0.7 (2018-10-04)

Full Changelog

v1.0.6 (2018-10-04)

Full Changelog

Closed issues:

  • Dosen't work with storybook/html #1

Merged pull requests:

  • make addon aware of active prop so storybook renders in its own panel #3 (actraiser)

v1.0.5 (2018-09-09)

Full Changelog

v1.0.4 (2018-09-09)

Full Changelog

v1.0.2 (2018-06-15)

Full Changelog

v1.0.1 (2018-06-15)

* This Change Log was automatically generated by github_changelog_generator