cetirizine

An experimental matrix client written in reactjs utilizing tailwind and storybook
git clone git://archive.git.mtrnord.blog/MTRNord/cetirizine.git
Log | Files | Refs | README | LICENSE

withTailwindTheme.decorator.tsx (440B)


      1 
      2 import { useEffect } from "react";
      3 
      4 export const DEFAULT_THEME = "light";
      5 
      6 export const withTailwindTheme = (Story: any, context) => {
      7     const { theme } = context.globals;
      8 
      9     useEffect(() => {
     10         const htmlTag = document.documentElement;
     11 
     12         // Set the "data-mode" attribute on the iFrame html tag
     13         htmlTag.setAttribute("data-mode", theme || DEFAULT_THEME);
     14     }, [theme]);
     15 
     16     // @ts-ignore
     17     return <Story />;
     18 };