Skip to content

Commit

Permalink
⬅️ Revert chromatic preview
Browse files Browse the repository at this point in the history
  • Loading branch information
KenAJoh committed Feb 4, 2025
1 parent 8a4a2ef commit b533b27
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Preview } from "@storybook/react";
import React, { useLayoutEffect } from "react";
// @ts-expect-error - Temporary
import darksideCss from "../@navikt/core/css/darkside/index.css?inline";

/* import defaultCss from "../@navikt/core/css/index.css?inline"; */
// @ts-expect-error - Temporary
import defaultCss from "../@navikt/core/css/index.css?inline";
import { Provider } from "../@navikt/core/react/src/provider";
import { Theme } from "../@navikt/core/react/src/theme";
import en from "../@navikt/core/react/src/util/i18n/locales/en";
Expand All @@ -15,34 +15,26 @@ import "./layout.css";
const ModeDecorator = ({ children, mode, theme }) => {
useLayoutEffect(() => {
const style = document.createElement("style");
/* style.innerHTML = mode === "darkside" ? darksideCss : defaultCss; */
style.innerHTML = darksideCss;
style.innerHTML = mode === "darkside" ? darksideCss : defaultCss;
document.head.appendChild(style);

/* if (mode === "darkside") {
if (mode === "darkside") {
document.body.style.setProperty("background", "var(--ax-bg-default)");
} */
document.body.style.setProperty("background", "var(--ax-bg-default)");
}

return () => {
document.head.removeChild(style);
document.body.style.removeProperty("background");
};
}, [mode]);

return (
<Theme theme={theme || undefined} hasBackground={false}>
{children}
</Theme>
);

/* return mode === "darkside" ? (
return mode === "darkside" ? (
<Theme theme={theme || undefined} hasBackground={false}>
{children}
</Theme>
) : (
children
); */
);
};

const translations = {
Expand Down

0 comments on commit b533b27

Please sign in to comment.