mirror of
https://github.com/hanzoai/shadcn.git
synced 2026-11-03 03:18:52 +00:00
Upstream sync from shadcn-ui/ui (1686 commits since last merge base). Key changes: - packages/shadcn upgraded to 4.1.0 (CLI font transformers, scaffold from github, chart colors) - apps/v4 replaces apps/www as the primary docs/registry app - Font system: 25+ heading font registries, font markers utility, @supports override - Chart improvements: recharts v3 compat, radial chart fixes - templates/ updated with monorepo variants (astro, vite, react-router, start) - skills/shadcn AI skill definitions added - deprecated/ removed (auth, auth-firebase, cli, www) Preserved Hanzo-only paths: app/, pkg/, demo/, docs/, template/next/
76 lines
2.1 KiB
TypeScript
76 lines
2.1 KiB
TypeScript
"use client"
|
|
|
|
import { TrendingUp } from "lucide-react"
|
|
import { Bar, BarChart, CartesianGrid, Cell, LabelList } from "recharts"
|
|
|
|
import {
|
|
Card,
|
|
CardContent,
|
|
CardDescription,
|
|
CardFooter,
|
|
CardHeader,
|
|
CardTitle,
|
|
} from "@/registry/new-york-v4/ui/card"
|
|
import {
|
|
ChartContainer,
|
|
ChartTooltip,
|
|
ChartTooltipContent,
|
|
type ChartConfig,
|
|
} from "@/registry/new-york-v4/ui/chart"
|
|
|
|
export const description = "A bar chart with negative values"
|
|
|
|
const chartData = [
|
|
{ month: "January", visitors: 186 },
|
|
{ month: "February", visitors: 205 },
|
|
{ month: "March", visitors: -207 },
|
|
{ month: "April", visitors: 173 },
|
|
{ month: "May", visitors: -209 },
|
|
{ month: "June", visitors: 214 },
|
|
]
|
|
|
|
const chartConfig = {
|
|
visitors: {
|
|
label: "Visitors",
|
|
},
|
|
} satisfies ChartConfig
|
|
|
|
export function ChartBarNegative() {
|
|
return (
|
|
<Card>
|
|
<CardHeader>
|
|
<CardTitle>Bar Chart - Negative</CardTitle>
|
|
<CardDescription>January - June 2024</CardDescription>
|
|
</CardHeader>
|
|
<CardContent>
|
|
<ChartContainer config={chartConfig}>
|
|
<BarChart accessibilityLayer data={chartData}>
|
|
<CartesianGrid vertical={false} />
|
|
<ChartTooltip
|
|
cursor={false}
|
|
content={<ChartTooltipContent hideLabel hideIndicator />}
|
|
/>
|
|
<Bar dataKey="visitors">
|
|
<LabelList position="top" dataKey="month" fillOpacity={1} />
|
|
{chartData.map((item) => (
|
|
<Cell
|
|
key={item.month}
|
|
fill={item.visitors > 0 ? "var(--chart-1)" : "var(--chart-2)"}
|
|
/>
|
|
))}
|
|
</Bar>
|
|
</BarChart>
|
|
</ChartContainer>
|
|
</CardContent>
|
|
<CardFooter className="flex-col items-start gap-2 text-sm">
|
|
<div className="flex gap-2 leading-none font-medium">
|
|
Trending up by 5.2% this month <TrendingUp className="h-4 w-4" />
|
|
</div>
|
|
<div className="leading-none text-muted-foreground">
|
|
Showing total visitors for the last 6 months
|
|
</div>
|
|
</CardFooter>
|
|
</Card>
|
|
)
|
|
}
|