import { setCompodocJson } from "@storybook/addon-docs/angular";
import { componentWrapperDecorator } from "@storybook/angular";
import type { Preview } from "@storybook/angular";
import docJson from "../documentation.json";
setCompodocJson(docJson);
const decorator = componentWrapperDecorator(
(story) => {
return `
${story}
${story}
${story}
${story}
`;
},
({ globals }) => {
return { theme: `${globals["theme"]}` };
},
);
const preview: Preview = {
decorators: [decorator],
globalTypes: {
theme: {
description: "Global theme for components",
defaultValue: "both",
toolbar: {
title: "Theme",
icon: "circlehollow",
items: [
{
title: "Light & Dark",
value: "both",
icon: "sidebyside",
},
{
title: "Light",
value: "light",
icon: "sun",
},
{
title: "Dark",
value: "dark",
icon: "moon",
},
{
title: "Nord",
value: "nord",
left: "⛰",
},
{
title: "Solarized",
value: "solarized",
left: "☯",
},
],
dynamicTitle: true,
},
},
},
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
options: {
storySort: {
method: "alphabetical",
order: ["Documentation", ["Introduction", "Colors", "Icons"], "Component Library"],
},
},
docs: { source: { type: "dynamic", excludeDecorators: true } },
},
tags: ["autodocs"],
};
export default preview;