storybook-addon-measure-viewport
Version:
Measures the height and width of the current viewport
16 lines (15 loc) • 462 B
JavaScript
import { addons, types } from "@storybook/addons";
import { ADDON_ID, TOOL_ID } from "../constants";
import { Tool } from "../Tool"; // Register the addon
addons.register(ADDON_ID, function () {
// Register the tool
addons.add(TOOL_ID, {
type: types.TOOL,
title: "Measure Viewport",
match: function match(_ref) {
var viewMode = _ref.viewMode;
return !!(viewMode && viewMode.match(/^(story|docs)$/));
},
render: Tool
});
});