Files
shadcn-ui/apps/v4/components/cards/stats.tsx
shadcn 1aa35048a5 feat: v4 updates (#7499)
* feat(v4): update home page

* fix

* fix: cards

* feat(v4): charts page

* feat: update pages

* feat: colors

* fix

* feat: add docs

* feat: mdx work

* fix

* fix

* fix: sidebar

* fix: lint

* feat: updates

* feat: update components

* feat: fix docs

* fix: responsive

* feat: implement cmdk

* fix: update navigation menu demo

* fix: code style

* fix: themes

* feat: implement blocks page

* fix: docs config

* refactor

* fix: outputFileTracingIncludes

* fix

* fix: output

* fix

* fix: registry

* refactor: move docs

* debug: docs

* debug

* revert

* fix: mjs

* deps: pin fumadocs

* debug

* fix: downgrade next

* fix: index page

* refactor: move mdx components

* fix: remove copy button

* fix

* was it zod

* yes it was

* remove copy page

* fix: color page

* fix: colors page

* fix: meta colors

* fix: copy button

* feat: sync registry

* fix: registry build script

* feat: update port

* feat: clean up examples

* fix

* fix: mobile nav

* fix: blur for mobile

* fix: sidebar nav

* feat: update examples

* fix: build scripts

* feat: update components

* feat: restyle

* fix: types

* fix: styles

* fix: margins

* fix: screenshots

* fix

* feat: update theme

* fix: charts nav

* fix: image

* feat: optimize images

* fix: menu

* fix: card

* fix: border

* check

* feat: implement charts page

* fix: charts

* fix: og images

* feat: extend touch

* fix: static

* fix: sizing

* fix: mobile screenshots

* fix: page nav

* fix

* feat: update favicon

* fix: theme selector

* fix: feedback

* fix: sink

* docs: update

* fix: styles

* chore: update registry

* fix: command

* fix

* fix: minor updates

* fix: typography on smaller devices

* fix: format

* fix: remove unused icon

* feat: update favicon

* fix: typography

* docs: typography page

* fix: steps
2025-05-30 11:35:16 +04:00

130 lines
3.0 KiB
TypeScript

"use client"
import { Area, AreaChart, Line, LineChart } from "recharts"
import { Button } from "@/registry/new-york-v4/ui/button"
import {
Card,
CardAction,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/registry/new-york-v4/ui/card"
import { ChartConfig, ChartContainer } from "@/registry/new-york-v4/ui/chart"
const data = [
{
revenue: 10400,
subscription: 40,
},
{
revenue: 14405,
subscription: 90,
},
{
revenue: 9400,
subscription: 200,
},
{
revenue: 8200,
subscription: 278,
},
{
revenue: 7000,
subscription: 89,
},
{
revenue: 9600,
subscription: 239,
},
{
revenue: 11244,
subscription: 78,
},
{
revenue: 26475,
subscription: 89,
},
]
const chartConfig = {
revenue: {
label: "Revenue",
color: "var(--primary)",
},
subscription: {
label: "Subscriptions",
color: "var(--primary)",
},
} satisfies ChartConfig
export function CardsStats() {
return (
<div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-1 xl:grid-cols-2">
<Card>
<CardHeader>
<CardDescription>Total Revenue</CardDescription>
<CardTitle className="text-3xl">$15,231.89</CardTitle>
<CardDescription>+20.1% from last month</CardDescription>
</CardHeader>
<CardContent className="pb-0">
<ChartContainer config={chartConfig} className="h-[80px] w-full">
<LineChart
data={data}
margin={{
top: 5,
right: 10,
left: 10,
bottom: 0,
}}
>
<Line
type="monotone"
strokeWidth={2}
dataKey="revenue"
stroke="var(--color-revenue)"
activeDot={{
r: 6,
}}
/>
</LineChart>
</ChartContainer>
</CardContent>
</Card>
<Card className="pb-0 lg:hidden xl:flex">
<CardHeader>
<CardDescription>Subscriptions</CardDescription>
<CardTitle className="text-3xl">+2,350</CardTitle>
<CardDescription>+180.1% from last month</CardDescription>
<CardAction>
<Button variant="ghost" size="sm">
View More
</Button>
</CardAction>
</CardHeader>
<CardContent className="mt-auto max-h-[124px] flex-1 p-0">
<ChartContainer config={chartConfig} className="size-full">
<AreaChart
data={data}
margin={{
left: 0,
right: 0,
}}
>
<Area
dataKey="subscription"
fill="var(--color-subscription)"
fillOpacity={0.05}
stroke="var(--color-subscription)"
strokeWidth={2}
type="monotone"
/>
</AreaChart>
</ChartContainer>
</CardContent>
</Card>
</div>
)
}