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 1
1
{
2
2
"name" : " shadcn-theme-editor" ,
3
- "version" : " 1.3.0 " ,
3
+ "version" : " 1.3.1 " ,
4
4
"description" : " Shadcn Theme Editor" ,
5
5
"main" : " dist/index.js" ,
6
6
"module" : " dist/index.mjs" ,
Original file line number Diff line number Diff line change 1
1
import { ThemeWithHSLColor } from "../lib/theme" ;
2
- import React , { useEffect , useState } from "react" ;
2
+ import React , { useCallback , useEffect , useState } from "react" ;
3
3
import { Button } from "./ui/button" ;
4
4
import { copy2clipboard , HSL2ComputedColor , setStyleColor } from "../lib/utils" ;
5
5
import { useDebounceCallback } from "../hooks/useDebounceCallback" ;
@@ -17,10 +17,13 @@ export function Item({
17
17
useEffect ( ( ) => {
18
18
setColor ( colord ( theme . color ) . toHex ( ) ) ;
19
19
} , [ 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
+ ) ;
24
27
return (
25
28
< Button
26
29
variant = { "colorbtn" }
@@ -39,7 +42,9 @@ export function Item({
39
42
// defaultValue={colord(color).toHex()}
40
43
value = { color }
41
44
type = "color"
42
- onChange = { ( e ) => ( setColor ( e . target . value ) , updateValue ( ) ) }
45
+ onChange = { ( e ) => (
46
+ setColor ( e . target . value ) , updateValue ( e . target . value )
47
+ ) }
43
48
className = "absolute cursor-pointer inset-1/2 size-[calc(100%+12px)] -translate-x-1/2 -translate-y-1/2 flex-shrink-0 bg-transparent"
44
49
/>
45
50
</ div >
You can’t perform that action at this time.
0 commit comments