From 517b996fa0b08990fae7e2fca3247c4253794fda Mon Sep 17 00:00:00 2001 From: Carlos Date: Fri, 5 Oct 2018 00:36:02 +0800 Subject: [PATCH] revert #3: this will broken addon --- package.json | 2 +- src/Themes.tsx | 17 +++++++---------- src/__tests__/Themes.spec.tsx | 2 +- src/register.tsx | 2 +- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index f7b9108..940ba5e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "storybook-addon-styled-component-theme", - "version": "1.0.6", + "version": "1.0.7", "description": "storybook addon with styled-components theme", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/Themes.tsx b/src/Themes.tsx index 12299f9..2d1e823 100644 --- a/src/Themes.tsx +++ b/src/Themes.tsx @@ -6,7 +6,6 @@ import {Theme} from "./types/Theme"; export interface ThemeProps { channel: any; api: any; - active: boolean; } interface ThemeState { @@ -23,15 +22,13 @@ interface ThemeHandler { type BaseComponentProps = ThemeProps & ThemeState & ThemeHandler; -const BaseComponent: React.SFC = ({onSelectTheme, themes, theme, active}) => ( - active ? ( -
- {themes.map((th, i) => { - const buttonStyle = th === theme ? SelectedButtonStyle : ButtonStyle; - return
onSelectTheme(th)}>{th.name}
; - }).toArray()} -
- ) : (
) +const BaseComponent: React.SFC = ({onSelectTheme, themes, theme}) => ( +
+ {themes.map((th, i) => { + const buttonStyle = th === theme ? SelectedButtonStyle : ButtonStyle; + return
onSelectTheme(th)}>{th.name}
; + }).toArray()} +
); export const Themes = compose( diff --git a/src/__tests__/Themes.spec.tsx b/src/__tests__/Themes.spec.tsx index 9de2881..dfeb4c2 100644 --- a/src/__tests__/Themes.spec.tsx +++ b/src/__tests__/Themes.spec.tsx @@ -11,7 +11,7 @@ describe("Themes spec", () => { removeListener: stub(), }; - const component = mount(); + const component = mount(); expect(component.render()).toMatchSnapshot(); expect(channel.on.calledOnce).toBeTruthy(); expect(channel.emit.notCalled).toBeTruthy(); diff --git a/src/register.tsx b/src/register.tsx index 350b9f1..ef351f6 100644 --- a/src/register.tsx +++ b/src/register.tsx @@ -6,6 +6,6 @@ addons.register("storybook/themes", (api) => { // Also need to set a unique name to the panel. addons.addPanel("storybook/themes/panel", { title: "Themes", - render: ({ active }) => (), + render: () => (), }); });