From 49610c9bb2c22715247836377691c5a8bc92dc6c Mon Sep 17 00:00:00 2001 From: immi Date: Mon, 9 Sep 2024 01:38:13 +0500 Subject: [PATCH] v1.3.2 - editor open button with only icon - add close button on sidebar - double click to copy single color --- package.json | 5 +++-- src/components/SideBarColors.tsx | 16 ++++++---------- src/components/editor-open.tsx | 17 +++++++++-------- src/components/icons.tsx | 19 +++++++++++++++++++ src/components/item.tsx | 3 ++- src/components/random.tsx | 17 ++++------------- src/components/reset-theme.tsx | 2 -- src/components/sidebar.tsx | 11 ++++++++--- src/components/theme-toggle.tsx | 1 - src/hooks/useLocalStroageTheme.ts | 11 ----------- 10 files changed, 51 insertions(+), 51 deletions(-) delete mode 100644 src/hooks/useLocalStroageTheme.ts diff --git a/package.json b/package.json index 306da15..154adfb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "shadcn-theme-editor", - "version": "1.3.1", + "version": "1.3.2", "description": "Shadcn Theme Editor", "main": "dist/index.js", "module": "dist/index.mjs", @@ -16,7 +16,8 @@ "scripts": { "build": "rollup -c --bundleConfigAsCjs && python ./update-css-file.py && npm link && npm pack", "test": "echo \"Error: no test specified\" && exit 1", - "release": "release-it" + "release": "release-it", + "clean": "rimraf dist" }, "keywords": [ "shadcn-theme-editor", diff --git a/src/components/SideBarColors.tsx b/src/components/SideBarColors.tsx index 8d31322..60cd25b 100644 --- a/src/components/SideBarColors.tsx +++ b/src/components/SideBarColors.tsx @@ -10,7 +10,10 @@ import { useEmittor } from "emittor"; import { themeEmittor } from "../lib/emittors"; function print(...props: any) { - if (typeof window !== "undefined" && (window as any).shadcnThemeEditorDebugMode) { + if ( + typeof window !== "undefined" && + (window as any).shadcnThemeEditorDebugMode + ) { console.log(...props); } } @@ -28,7 +31,6 @@ const ZodTheme = z.array( ); function SideBarColors() { - // const { resolvedTheme: currentTheme } = useTheme(); const { resolvedTheme } = useTheme(); const [currentTheme, setCurrentTheme] = useState(); @@ -53,22 +55,16 @@ function SideBarColors() { const isValid = ZodTheme.parse(theme); print("theme is valid and appling", isValid); print("applied theme", theme); - themeEmittor.applyTheme(theme) - // setColorsProperties(theme); - // setColors(theme); + themeEmittor.applyTheme(theme); return; } catch (error) { print("invalid theme found in localStorage"); // localStorage.removeItem(LOCAL_STORAGE_KEY+":"+currentTheme); //* remove key } } - // resetTheme() - // theme = getColors(true) as any; - // theme = getDefaultTheme() print("theme not found in localStorage"); print("Now theme: ", theme); - // setColors(theme as any); - themeEmittor.setDefaultTheme() + themeEmittor.setDefaultTheme(); }, [currentTheme]); return ( <> diff --git a/src/components/editor-open.tsx b/src/components/editor-open.tsx index 1a5ab84..3fc76f6 100644 --- a/src/components/editor-open.tsx +++ b/src/components/editor-open.tsx @@ -1,19 +1,20 @@ "use client"; import { useState } from "react"; import { Sidebar } from "./sidebar"; -import { Button } from "./ui/button"; +import { IoColorPalette } from "react-icons/io5"; +import clsx from "clsx"; function EditorOpenBtn() { - const [IsOpen, setIsOpen] = useState(false); + const [isOpen, setIsOpen] = useState(false); return (
- - + + +
); } diff --git a/src/components/icons.tsx b/src/components/icons.tsx index cb65b60..d29128a 100644 --- a/src/components/icons.tsx +++ b/src/components/icons.tsx @@ -81,3 +81,22 @@ export const Lock = (props: SVGProps) => ( ); + +export const X = (props: SVGProps) => ( + + + + +); diff --git a/src/components/item.tsx b/src/components/item.tsx index 66e8c1a..dd59ca0 100644 --- a/src/components/item.tsx +++ b/src/components/item.tsx @@ -27,9 +27,10 @@ export function Item({ return (
Shadcn Theme Editor
diff --git a/src/components/theme-toggle.tsx b/src/components/theme-toggle.tsx index 1f19240..cfa3e02 100644 --- a/src/components/theme-toggle.tsx +++ b/src/components/theme-toggle.tsx @@ -1,4 +1,3 @@ -"use client"; import { useTheme } from "next-themes"; import { cn } from "../lib/utils"; import { SVGProps, useEffect, useRef, useState } from "react"; diff --git a/src/hooks/useLocalStroageTheme.ts b/src/hooks/useLocalStroageTheme.ts deleted file mode 100644 index f48ae76..0000000 --- a/src/hooks/useLocalStroageTheme.ts +++ /dev/null @@ -1,11 +0,0 @@ -import React, { useEffect, useState } from 'react' - -function useLocalStroageTheme(theme?:string) { - const [isLocalThemeApply, setIsLocalThemeApply] = useState(false); - useEffect(() => { - - }, [theme]); - return {isLocalThemeApply} -} - -export default useLocalStroageTheme \ No newline at end of file