fix: charts

This commit is contained in:
shadcn
2026-01-18 12:11:20 +04:00
parent 5a42652c41
commit 094edfcfe6
4 changed files with 4 additions and 19 deletions

View File

@@ -63,7 +63,6 @@ export default function ChartsLayout({
</PageHeader>
<PageNav id="charts">
<ChartsNav />
<ThemeSelector className="mr-4 hidden md:flex" />
</PageNav>
<div className="container-wrapper section-soft flex-1">
<div className="container pb-6">

View File

@@ -1,22 +1,13 @@
"use client"
import { useSearchParams } from "next/navigation"
import { cn } from "@/lib/utils"
export function ComponentPreview({ children }: { children: React.ReactNode }) {
const searchParams = useSearchParams()
const theme = searchParams.get("theme") ?? "default"
return (
<div
className={cn(
"bg-background *:data-[slot=card]:has-[[data-slot=chart]]:shadow-none",
`theme-${theme}`,
theme.endsWith("-scaled") && "theme-scaled"
"bg-background *:data-[slot=card]:has-[[data-slot=chart]]:shadow-none"
)}
>
<div className="theme-container">{children}</div>
{children}
</div>
)
}

View File

@@ -3,7 +3,6 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { useThemeConfig } from "@/components/active-theme"
export function ChartIframe({
src,
@@ -15,14 +14,10 @@ export function ChartIframe({
title: string
}) {
const [loaded, setLoaded] = React.useState(false)
const { activeTheme } = useThemeConfig()
// Append theme as query param so iframe can apply it.
const iframeSrc = `${src}?theme=${activeTheme}`
return (
<iframe
src={iframeSrc}
src={src}
className={cn(
"w-full border-none transition-opacity duration-300",
loaded ? "opacity-100" : "opacity-0"

View File

@@ -46,7 +46,7 @@ export function ChartToolbar({
}
function ChartTitle({ chart }: { chart: Chart }) {
if (chart.name.includes("charts-line")) {
if (chart.name.includes("chart-line")) {
return (
<>
<LineChartIcon /> Line Chart