From 8e206da694783fad776d16fe08236c5eeb35345f Mon Sep 17 00:00:00 2001 From: Lewis Nguyen Date: Thu, 25 Jan 2024 16:28:31 +0700 Subject: [PATCH] 1.2.6 --- lib/components/image/image-preview.tsx | 2 +- lib/components/image/image.tsx | 2 +- lib/components/toast/toast.component.tsx | 2 +- lib/components/toast/toast.provider.tsx | 4 ++-- lib/providers/zeni-provider.tsx | 13 +++++++++---- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/components/image/image-preview.tsx b/lib/components/image/image-preview.tsx index 5f471f1..578017a 100644 --- a/lib/components/image/image-preview.tsx +++ b/lib/components/image/image-preview.tsx @@ -2,7 +2,6 @@ import { AnimatePresence, motion } from "framer-motion"; import { useEffect, useMemo } from "react"; import { createPortal } from "react-dom"; import { twMerge } from "tailwind-merge"; -import { useComponentStyle } from "../../main"; import { IImagePreview } from "./image.types"; import { useImagePreview } from "./use-image-preview"; import { @@ -13,6 +12,7 @@ import { SearchZoomIn1, SearchZoomOut1, } from "iconsax-react"; +import { useComponentStyle } from "../../customization/styles/theme.context"; export const ImagePreview = ({ backdropClassName = "", diff --git a/lib/components/image/image.tsx b/lib/components/image/image.tsx index 2257be3..ffdcaed 100644 --- a/lib/components/image/image.tsx +++ b/lib/components/image/image.tsx @@ -1,9 +1,9 @@ import { useState } from "react"; import { twMerge } from "tailwind-merge"; -import { useComponentStyle } from "../../main"; import { ImagePreview } from "./image-preview"; import { ImageComponent } from "./image.component"; import { IImage } from "./image.types"; +import { useComponentStyle } from "../../customization/styles/theme.context"; export const Image = ({ isPreviewable = true, diff --git a/lib/components/toast/toast.component.tsx b/lib/components/toast/toast.component.tsx index cc14276..8caf7f0 100644 --- a/lib/components/toast/toast.component.tsx +++ b/lib/components/toast/toast.component.tsx @@ -1,11 +1,11 @@ import { Variants, motion, useIsPresent } from "framer-motion"; import { memo, useEffect, useMemo, useState } from "react"; import { twMerge } from "tailwind-merge"; -import { useComponentStyle } from "../../main"; import { Alert } from "../alert/alert"; import { ToastProviderProps } from "./toast.provider"; import { ToastOptions } from "./toast.types"; import { useTimeout } from "./toast.utils"; +import { useComponentStyle } from "../../customization/styles/theme.context"; const toastMotionVariants: Variants = { initial: (props: ToastOptions) => { diff --git a/lib/components/toast/toast.provider.tsx b/lib/components/toast/toast.provider.tsx index 5d0937b..4e133b6 100644 --- a/lib/components/toast/toast.provider.tsx +++ b/lib/components/toast/toast.provider.tsx @@ -2,10 +2,10 @@ import { AnimatePresence } from "framer-motion"; import { createContext, useContext, useSyncExternalStore } from "react"; import { createPortal } from "react-dom"; import { twMerge } from "tailwind-merge"; -import { useComponentStyle } from "../../main"; import { ToastComponent } from "./toast.component"; import { toastStore } from "./toast.store"; import { CloseAllToastsOptions, ToastId, ToastOptions } from "./toast.types"; +import { useComponentStyle } from "../../customization/styles/theme.context"; export interface ToastMethods { notify: (options?: ToastOptions) => ToastId; @@ -48,7 +48,7 @@ export const useToastOptionContext = () => { export const ToastProvider = (props: ToastProviderProps) => { const theme = useComponentStyle("Toast"); - const { toastSpacing = '6px' } = props; + const { toastSpacing = "6px" } = props; const state = useSyncExternalStore( toastStore.subscribe, toastStore.getState, diff --git a/lib/providers/zeni-provider.tsx b/lib/providers/zeni-provider.tsx index dcfce66..0aab651 100644 --- a/lib/providers/zeni-provider.tsx +++ b/lib/providers/zeni-provider.tsx @@ -1,7 +1,11 @@ import { useEffect } from "react"; -import { ToastOptionProvider, ToastProvider, ToastProviderProps, applyTheme } from "../main"; +import { + ToastOptionProvider, + ToastProvider, + ToastProviderProps, +} from "../main"; import { ThemeType } from "../customization/theme"; - +import { applyTheme } from "../customization/theme/utils"; export const ZeniProvider = ({ initialTheme, @@ -12,7 +16,6 @@ export const ZeniProvider = ({ children: React.ReactNode; toastOptions?: ToastProviderProps; }) => { - useEffect(() => { const savedTheme = localStorage.getItem("theme"); const defaultTheme = @@ -23,7 +26,9 @@ export const ZeniProvider = ({ return ( <> - {children} + + {children} + );