@ljcl/storybook-addon-cssprops
Version:
Interact with css custom properties dynamically in the Storybook UI
23 lines (22 loc) • 867 B
JavaScript
import * as React from "react";
import { addons, types } from "@storybook/manager-api";
import { AddonPanel } from "@storybook/components";
import { CssPropsPanel } from "./components/CssPropsPanel";
import { useTitle } from "./title";
import { ADDON_ID, PARAM_KEY } from "./constants";
addons.register(ADDON_ID, function (api) {
addons.add(ADDON_ID, {
title: useTitle,
type: types.PANEL,
paramKey: PARAM_KEY,
render: function (_a) {
var active = _a.active;
var story = api.getCurrentStoryData();
if (!active || !story) {
return React.createElement(React.Fragment, { key: "nothing" }, "-");
}
return (React.createElement(AddonPanel, { active: !!active },
React.createElement(CssPropsPanel, { storyId: story.id })));
},
});
});