88 getThemesForBaseColor ,
99 type ChartColorName ,
1010} from "@/registry/config"
11- import { useCustomizerLayout } from "@/app/(create)/components/customizer-layout"
1211import { LockButton } from "@/app/(create)/components/lock-button"
1312import {
1413 Picker ,
@@ -17,22 +16,19 @@ import {
1716 PickerRadioGroup ,
1817 PickerRadioItem ,
1918 PickerSeparator ,
20- PickerValueTrigger ,
19+ PickerTrigger ,
2120} from "@/app/(create)/components/picker"
2221import { useDesignSystemSearchParams } from "@/app/(create)/lib/search-params"
2322
2423export function ChartColorPicker ( {
2524 isMobile,
2625 anchorRef,
27- collapsed = false ,
2826} : {
2927 isMobile : boolean
3028 anchorRef : React . RefObject < HTMLDivElement | null >
31- collapsed ?: boolean
3229} ) {
3330 const mounted = useMounted ( )
3431 const [ params , setParams ] = useDesignSystemSearchParams ( )
35- const { desktopPickerSide } = useCustomizerLayout ( )
3632
3733 const availableChartColors = React . useMemo (
3834 ( ) => getThemesForBaseColor ( params . baseColor ) ,
@@ -56,33 +52,35 @@ export function ChartColorPicker({
5652 }
5753 } , [ currentChartColor , availableChartColors , setParams ] )
5854
59- const chartColorIndicator = mounted ? (
60- < div
61- style = {
62- {
63- "--color" :
64- currentChartColor ?. cssVars ?. dark ?. [
65- currentChartColorIsBaseColor ? "muted-foreground" : "primary"
66- ] ,
67- } as React . CSSProperties
68- }
69- className = "size-4 rounded-full bg-(--color)"
70- />
71- ) : null
72-
7355 return (
7456 < div className = "group/picker relative" >
7557 < Picker >
76- < PickerValueTrigger
77- label = "Chart Color"
78- value = { currentChartColor ?. title }
79- valueText = { currentChartColor ?. title }
80- indicator = { chartColorIndicator }
81- collapsed = { collapsed }
82- />
58+ < PickerTrigger >
59+ < div className = "flex flex-col justify-start text-left" >
60+ < div className = "text-xs text-muted-foreground" > Chart Color</ div >
61+ < div className = "text-sm font-medium text-foreground" >
62+ { currentChartColor ?. title }
63+ </ div >
64+ </ div >
65+ { mounted && (
66+ < div
67+ style = {
68+ {
69+ "--color" :
70+ currentChartColor ?. cssVars ?. dark ?. [
71+ currentChartColorIsBaseColor
72+ ? "muted-foreground"
73+ : "primary"
74+ ] ,
75+ } as React . CSSProperties
76+ }
77+ className = "pointer-events-none absolute top-1/2 right-4 size-4 -translate-y-1/2 rounded-full bg-(--color) select-none md:right-2.5"
78+ />
79+ ) }
80+ </ PickerTrigger >
8381 < PickerContent
8482 anchor = { isMobile ? anchorRef : undefined }
85- side = { isMobile ? "top" : desktopPickerSide }
83+ side = { isMobile ? "top" : "right" }
8684 align = { isMobile ? "center" : "start" }
8785 className = "max-h-92"
8886 >
@@ -129,12 +127,10 @@ export function ChartColorPicker({
129127 </ PickerRadioGroup >
130128 </ PickerContent >
131129 </ Picker >
132- { ! collapsed ? (
133- < LockButton
134- param = "chartColor"
135- className = "absolute top-1/2 right-8 -translate-y-1/2"
136- />
137- ) : null }
130+ < LockButton
131+ param = "chartColor"
132+ className = "absolute top-1/2 right-8 -translate-y-1/2"
133+ />
138134 </ div >
139135 )
140136}
0 commit comments