import React, { useState } from "react"; import ThemeProvider, { ThemeProviderProps } from "../ThemeProvider"; import Button from "../../Button/Button"; import Dropdown from "../../Dropdown/Dropdown"; import Flex from "../../Flex/Flex"; import { productTheme1, productTheme2, productTheme3, productTheme4 } from "./product-themes"; import ColorsDescription from "../../../storybook/stand-alone-documentaion/colors/colors-description/colors-description"; import { ThemeColor } from "../ThemeProviderConstants"; import { Link, Tip, UsageGuidelines } from "vibe-storybook-components"; import styles from "./ThemeProvider.stories.module.scss"; export const ColorsEligibleForThemingTemplate = () => ; export const ThemeProviderTemplateOverview = (args: JSX.IntrinsicAttributes & ThemeProviderProps) => { return ( <> ); }; export const ThemeProviderThemingScopeTemplate = (_args: JSX.IntrinsicAttributes & ThemeProviderProps) => { return ( <> ); }; export const ThemeProviderFoldedThemingTemplate = (_args: JSX.IntrinsicAttributes & ThemeProviderProps) => { return (
); }; export const ThemeProviderProductThemingTemplate = (_args: JSX.IntrinsicAttributes & ThemeProviderProps) => { const dropdownOptions = [ { value: productTheme1, label: "Product 1" }, { value: productTheme2, label: "Product 2" }, { value: productTheme3, label: "Product 3" }, { value: productTheme4, label: "Product 4" } ]; const [selectedTheme, setSelectedTheme] = useState(null); return ( setSelectedTheme(null)} onOptionSelect={(option: any) => setSelectedTheme(option)} className={styles.productThemingDropdown} />
); }; export const ThemeProviderCustomClassTemplate = (_args: JSX.IntrinsicAttributes & ThemeProviderProps) => { return (
); }; export const ThemeProviderPositiveExampleTemplate = () => { return ( ); }; export const ThemeProviderNegativeExampleTemplate = () => { return ( ); }; export const TipDev = () => ( Use ThemeProvider.systemThemes and ThemeProvider.colors enums to unleash the power of auto-completion ); export const UsageGuidelinesThemeProvider = () => ( Control themes in your application by setting theme classes (e.g. .light-app-theme) on your{" "} body and render everything else inside it. Or use systemTheme prop to make ThemeProvider set the theme class on the body for you. , <> In most common case ThemeProvider should be rendered only once on the root level of the application - below the{" "} body. , <> ThemeProvider is populating theme name className to the new added div container which wraps the children. ]} /> ); export const DescriptionWithLinkMondaySdkIntegration = () => ( <> When developing an external application for monday.com (iframe). You can use ThemeProvider in combination with the{" "} monday.com SDK , to apply monday.com system and product themes to your application. This will allow your application to be consistent with the monday.com UI. ); export const MondaySdkIntegrationSourceCode = ` import { ThemeProvider } from "monday-ui-react-core"; import mondaySdk from "monday-sdk-js"; const monday = mondaySdk(); const useGetContext = () => { const [context, setContext] = useState({}); useEffect(() => { monday.listen("context", (res) => { setContext(res.data); }); }, []); return context; }; const AppWrapper = () => { const context = useGetContext(); return ( ); }; `;