manager.mjs (1027B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 /** This file handles registering the Storybook addon */ 6 7 import { addons, types } from "@storybook/manager-api"; 8 import { ADDON_ID, PANEL_ID, TOOL_ID } from "../constants.mjs"; 9 import { PseudoLocalizationButton } from "../PseudoLocalizationButton.jsx"; 10 import { FluentPanel } from "../FluentPanel.jsx"; 11 12 // Register the addon. 13 addons.register(ADDON_ID, () => { 14 // Register the tool. 15 addons.add(TOOL_ID, { 16 type: types.TOOL, 17 title: "Pseudo Localization", 18 // Toolbar button doesn't show on the "Docs" tab. 19 match: ({ viewMode }) => !!(viewMode && viewMode.match(/^story$/)), 20 render: PseudoLocalizationButton, 21 }); 22 23 addons.add(PANEL_ID, { 24 title: "Fluent", 25 //👇 Sets the type of UI element in Storybook 26 type: types.PANEL, 27 render: ({ active }) => FluentPanel({ active }), 28 }); 29 });