diff --git a/lib/components/menu/menu.tsx b/lib/components/menu/menu.tsx index faab9fd..26a8fed 100644 --- a/lib/components/menu/menu.tsx +++ b/lib/components/menu/menu.tsx @@ -61,7 +61,7 @@ export const Menu = ({ className={itemClasses} onClick={() => onMenuItemClick(x.key)} > -
{x.icon}
+ {!!x.icon &&
{x.icon}
} {x.title} )); diff --git a/lib/customization/theme/index.ts b/lib/customization/theme/index.ts index 70f1d85..87d15cd 100644 --- a/lib/customization/theme/index.ts +++ b/lib/customization/theme/index.ts @@ -1,25 +1,18 @@ -// src/themes/index.ts import baseDark from "./dark/base"; import baseLight from "./light/base"; import blueLight from "./light/blue"; -// import pinkLight from "./light/pink"; -// import greenLight from "./light/green"; import { IThemes } from "./utils"; -const THEMES = { +const themeList = { baseLight: "baseLight", blueLight: "blueLight", baseDark: "baseDark", - // pinkLight: "pinkLight", - // greenLight: "greenLight", }; -export type ThemeType = keyof typeof THEMES; +export type IThemeType = keyof typeof themeList; export const zeniThemes: IThemes = { baseLight, baseDark, blueLight, - // pinkLight, - // greenLight, }; diff --git a/lib/customization/theme/use-change-theme.tsx b/lib/customization/theme/use-change-theme.tsx index 4607002..4d3f5a3 100644 --- a/lib/customization/theme/use-change-theme.tsx +++ b/lib/customization/theme/use-change-theme.tsx @@ -1,11 +1,11 @@ import { useEffect, useState } from "react"; -import { ThemeType } from "."; +import { IThemeType } from "."; import { applyTheme } from "./utils"; export function useChangeTheme() { - const [theme, setTheme] = useState(() => { + const [theme, setTheme] = useState(() => { const savedTheme = localStorage.getItem("theme"); - return savedTheme ? (savedTheme as ThemeType) : undefined; + return savedTheme ? (savedTheme as IThemeType) : undefined; }); useEffect(() => { @@ -16,4 +16,4 @@ export function useChangeTheme() { }, [theme]); return { theme, setTheme }; -} \ No newline at end of file +} diff --git a/lib/customization/theme/utils.ts b/lib/customization/theme/utils.ts index c714cc5..e1b7856 100644 --- a/lib/customization/theme/utils.ts +++ b/lib/customization/theme/utils.ts @@ -1,6 +1,6 @@ import { zeniThemes } from "."; -export type ITheme = Record; +type ITheme = Record; export type IThemes = Record; diff --git a/lib/providers/zeni-provider.tsx b/lib/providers/zeni-provider.tsx index 0aab651..b7e9454 100644 --- a/lib/providers/zeni-provider.tsx +++ b/lib/providers/zeni-provider.tsx @@ -4,7 +4,7 @@ import { ToastProvider, ToastProviderProps, } from "../main"; -import { ThemeType } from "../customization/theme"; +import { IThemeType } from "../customization/theme"; import { applyTheme } from "../customization/theme/utils"; export const ZeniProvider = ({ @@ -12,14 +12,14 @@ export const ZeniProvider = ({ children, toastOptions, }: { - initialTheme?: ThemeType; + initialTheme?: IThemeType; children: React.ReactNode; toastOptions?: ToastProviderProps; }) => { useEffect(() => { const savedTheme = localStorage.getItem("theme"); const defaultTheme = - (savedTheme as ThemeType) || initialTheme || "baseLight"; + (savedTheme as IThemeType) || initialTheme || "baseLight"; applyTheme(defaultTheme); localStorage.setItem("theme", defaultTheme); }, [initialTheme]); diff --git a/package.json b/package.json index 44c1698..e4ebef4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "zeni-ui", "private": false, - "version": "1.2.6-beta", + "version": "1.2.7-beta", "type": "module", "main": "dist/main.js", "types": "dist/main.d.ts",