storybook-addon-styled-component-theme
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -14,3 +14,3 @@ "use strict"; | ||
}; | ||
var component = enzyme_1.mount(React.createElement(Themes_1.Themes, { api: null, channel: channel })); | ||
var component = enzyme_1.mount(React.createElement(Themes_1.Themes, { api: null, active: true, channel: channel })); | ||
expect(component.render()).toMatchSnapshot(); | ||
@@ -17,0 +17,0 @@ expect(channel.on.calledOnce).toBeTruthy(); |
@@ -10,5 +10,8 @@ "use strict"; | ||
title: "Themes", | ||
render: function () { return (React.createElement(Themes_1.Themes, { channel: addons_1.default.getChannel(), api: api })); }, | ||
render: function (_a) { | ||
var active = _a.active; | ||
return (React.createElement(Themes_1.Themes, { channel: addons_1.default.getChannel(), api: api, active: active })); | ||
}, | ||
}); | ||
}); | ||
//# sourceMappingURL=register.js.map |
@@ -5,3 +5,4 @@ import * as React from "react"; | ||
api: any; | ||
active: boolean; | ||
} | ||
export declare const Themes: React.ComponentClass<ThemeProps>; |
@@ -15,7 +15,7 @@ "use strict"; | ||
var BaseComponent = function (_a) { | ||
var onSelectTheme = _a.onSelectTheme, themes = _a.themes, theme = _a.theme; | ||
return (React.createElement("div", { style: RowStyle }, themes.map(function (th, i) { | ||
var onSelectTheme = _a.onSelectTheme, themes = _a.themes, theme = _a.theme, active = _a.active; | ||
return (active ? (React.createElement("div", { style: RowStyle }, themes.map(function (th, i) { | ||
var buttonStyle = th === theme ? SelectedButtonStyle : ButtonStyle; | ||
return React.createElement("div", { style: buttonStyle, key: i, onClick: function () { return onSelectTheme(th); } }, th.name); | ||
}).toArray())); | ||
}).toArray())) : (React.createElement("div", null))); | ||
}; | ||
@@ -22,0 +22,0 @@ exports.Themes = recompose_1.compose(recompose_1.withState("theme", "setTheme", null), recompose_1.withState("themes", "setThemes", immutable_1.List()), recompose_1.withHandlers({ |
{ | ||
"name": "storybook-addon-styled-component-theme", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "storybook addon with styled-components theme", | ||
@@ -10,2 +10,3 @@ "main": "dist/index.js", | ||
"build": "npm run clean && tsc -p .", | ||
"pretest": "tslint -p .", | ||
"test": "jest", | ||
@@ -38,2 +39,3 @@ "prepare": "npm run build" | ||
"ts-jest": "^23.1.4", | ||
"tslint": "^5.11.0", | ||
"typescript": "^2.9.2" | ||
@@ -40,0 +42,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
18851
240
19
30