@@ -12,6 +12,7 @@ import { IconPickerDialog } from "../../dialogs/icon-picker-dialog";
1212import { Slider } from "@/components/ui/slider" ;
1313import { cn } from "@/lib/utils" ;
1414import { CornerDownRightIcon } from "lucide-react" ;
15+ import { ToggleGroupNav } from "../../ui/toggle-group-nav" ;
1516
1617type propertiesWhitelist = "type" | "content" | "variant" | "icon" ;
1718
@@ -36,6 +37,9 @@ export function ButtonGroup({
3637 let defaultValueIconStrokeWidth = selectedComponent . getField (
3738 "properties.style.iconStrokeWidth"
3839 ) ;
40+ let defaultValueIconPosition = selectedComponent . getField (
41+ "properties.style.iconPosition"
42+ ) ;
3943 const handleChange = (
4044 field : string ,
4145 value : any ,
@@ -125,43 +129,65 @@ export function ButtonGroup({
125129 </ div >
126130 </ div >
127131 { defaultValueIcon && (
128- < div className = "grid grid-cols-2 gap-2 items-start mt-4" >
129- < div className = "flex flex-row items-center gap-2 pl-2" >
130- < CornerDownRightIcon className = "size-4 text-gray-400" />
131- < Label className = "text-xs text-gray-400" > Stroke Width</ Label >
132- </ div >
133- < div className = "flex flex-col items-center pt-1" >
134- < Slider
135- value = { [ defaultValueIconStrokeWidth ] }
136- onValueChange = { ( value ) =>
137- handleChange ( "properties.style.iconStrokeWidth" , value [ 0 ] , true )
138- }
139- className = "[&>:last-child>span]:border-background [&>:last-child>span]:bg-primary **:data-[slot=slider-thumb]:shadow-none [&>:last-child>span]:h-6 [&>:last-child>span]:w-2.5 [&>:last-child>span]:border-[3px] [&>:last-child>span]:ring-offset-0"
140- min = { 0.5 }
141- max = { 3 }
142- step = { 0.25 }
143- />
144- < span
145- className = "text-muted-foreground mt-3 flex w-full items-center justify-between gap-1 px-2.5 text-xs font-medium"
146- aria-hidden = "true"
147- >
148- { ticks . map ( ( tick , i ) => (
132+ < div className = "space-y-4 ml-2" >
133+ < div className = "grid grid-cols-2 gap-2 items-start mt-4" >
134+ < Label className = "text-xs text-gray-400" > Stroke Width</ Label >
135+ < div className = "flex flex-col items-center pt-1" >
136+ < Slider
137+ value = { [ defaultValueIconStrokeWidth ] }
138+ onValueChange = { ( value ) =>
139+ handleChange (
140+ "properties.style.iconStrokeWidth" ,
141+ value [ 0 ] ,
142+ true
143+ )
144+ }
145+ className = "[&>:last-child>span]:border-background [&>:last-child>span]:bg-primary **:data-[slot=slider-thumb]:shadow-none [&>:last-child>span]:h-6 [&>:last-child>span]:w-2 [&>:last-child>span]:border-[3px] [&>:last-child>span]:ring-offset-0"
146+ min = { 0.5 }
147+ max = { 3 }
148+ step = { 0.25 }
149+ />
149150 < span
150- key = { i }
151- className = "flex w-0 flex-col items-center justify-center gap-2 "
151+ className = "text-muted-foreground mt-3 flex w-full items-center justify-between gap-1 px-2.5 text-xs font-medium"
152+ aria-hidden = "true "
152153 >
153- < span
154- className = { cn (
155- "bg-muted-foreground/70 h-1 w-px" ,
156- i % skipInterval !== 0 && "h-0.5"
157- ) }
158- />
159- < span className = { cn ( i % skipInterval !== 0 && "opacity-0" ) } >
160- { tick }
161- </ span >
154+ { ticks . map ( ( tick , i ) => (
155+ < span
156+ key = { i }
157+ className = "flex w-0 flex-col items-center justify-center gap-2"
158+ >
159+ < span
160+ className = { cn (
161+ "bg-muted-foreground/70 h-1 w-px" ,
162+ i % skipInterval !== 0 && "h-0.5"
163+ ) }
164+ />
165+ < span
166+ className = { cn ( i % skipInterval !== 0 && "opacity-0" ) }
167+ >
168+ { tick }
169+ </ span >
170+ </ span >
171+ ) ) }
162172 </ span >
163- ) ) }
164- </ span >
173+ </ div >
174+ </ div >
175+ < div className = "grid grid-cols-2 gap-2 items-center" >
176+ < Label className = "text-xs text-gray-400" > Position</ Label >
177+ < div className = "flex flex-row items-center gap-2" >
178+ < ToggleGroupNav
179+ name = "iconPosition"
180+ items = { [
181+ { value : "left" , label : "left" } ,
182+ { value : "right" , label : "right" } ,
183+ ] }
184+ defaultValue = { defaultValueIconPosition }
185+ onValueChange = { ( value ) =>
186+ handleChange ( "properties.style.iconPosition" , value , true )
187+ }
188+ className = "w-full"
189+ />
190+ </ div >
165191 </ div >
166192 </ div >
167193 ) }
0 commit comments