mirror of
https://github.com/goauthentik/authentik
synced 2026-04-25 17:15:26 +02:00
19 lines
668 B
TypeScript
19 lines
668 B
TypeScript
import { extendStorybookTheme } from "./theme.js";
|
|
|
|
import { createUIThemeEffect, resolveUITheme } from "@goauthentik/web/common/theme.ts";
|
|
|
|
import { DocsContainer, DocsContainerProps } from "@storybook/addon-docs/blocks";
|
|
import { useEffect, useMemo, useState } from "react";
|
|
|
|
export const ThemedDocsContainer: React.FC<DocsContainerProps> = ({
|
|
theme: initialTheme = resolveUITheme(),
|
|
...props
|
|
}) => {
|
|
const [theme, setTheme] = useState(initialTheme);
|
|
const resolvedTheme = useMemo(() => extendStorybookTheme(theme), [theme]);
|
|
|
|
useEffect(() => createUIThemeEffect(setTheme), []);
|
|
|
|
return <DocsContainer {...props} theme={resolvedTheme} />;
|
|
};
|