MCPcopy Create free account
hub / github.com/code-with-antonio/nodebase / ChartStyle

Function ChartStyle

src/components/ui/chart.tsx:72–103  ·  view source on GitHub ↗
({ id, config }: { id: string; config: ChartConfig })

Source from the content-addressed store, hash-verified

70}
71
72const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
73 const colorConfig = Object.entries(config).filter(
74 ([, config]) => config.theme || config.color
75 )
76
77 if (!colorConfig.length) {
78 return null
79 }
80
81 return (
82 <style
83 dangerouslySetInnerHTML={{
84 __html: Object.entries(THEMES)
85 .map(
86 ([theme, prefix]) => `
87${prefix} [data-chart=${id}] {
88${colorConfig
89 .map(([key, itemConfig]) => {
90 const color =
91 itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ||
92 itemConfig.color
93 return color ? ` --color-${key}: ${color};` : null
94 })
95 .join("\n")}
96}
97`
98 )
99 .join("\n"),
100 }}
101 />
102 )
103}
104
105const ChartTooltip = RechartsPrimitive.Tooltip
106

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected