File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed
Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " shadcn-theme-editor" ,
3- "version" : " 1.3.0 " ,
3+ "version" : " 1.3.1 " ,
44 "description" : " Shadcn Theme Editor" ,
55 "main" : " dist/index.js" ,
66 "module" : " dist/index.mjs" ,
Original file line number Diff line number Diff line change 11import { ThemeWithHSLColor } from "../lib/theme" ;
2- import React , { useEffect , useState } from "react" ;
2+ import React , { useCallback , useEffect , useState } from "react" ;
33import { Button } from "./ui/button" ;
44import { copy2clipboard , HSL2ComputedColor , setStyleColor } from "../lib/utils" ;
55import { useDebounceCallback } from "../hooks/useDebounceCallback" ;
@@ -17,10 +17,13 @@ export function Item({
1717 useEffect ( ( ) => {
1818 setColor ( colord ( theme . color ) . toHex ( ) ) ;
1919 } , [ theme ] ) ;
20- const updateValue = useDebounceCallback ( ( ) => {
21- setStyleColor ( theme . variable , colord ( color ) . toHsl ( ) ) ;
22- onSave ( ) ;
23- } , 0 ) ;
20+ const updateValue = useCallback (
21+ useDebounceCallback ( ( color : string ) => {
22+ setStyleColor ( theme . variable , colord ( color ) . toHsl ( ) ) ;
23+ onSave ( ) ;
24+ } , 0 ) ,
25+ [ theme . variable ]
26+ ) ;
2427 return (
2528 < Button
2629 variant = { "colorbtn" }
@@ -39,7 +42,9 @@ export function Item({
3942 // defaultValue={colord(color).toHex()}
4043 value = { color }
4144 type = "color"
42- onChange = { ( e ) => ( setColor ( e . target . value ) , updateValue ( ) ) }
45+ onChange = { ( e ) => (
46+ setColor ( e . target . value ) , updateValue ( e . target . value )
47+ ) }
4348 className = "absolute cursor-pointer inset-1/2 size-[calc(100%+12px)] -translate-x-1/2 -translate-y-1/2 flex-shrink-0 bg-transparent"
4449 />
4550 </ div >
You can’t perform that action at this time.
0 commit comments