Skip to content

Commit f47bb97

Browse files
authored
feat: e-commerce dashboard blocks (shadcn-ui#3236)
* feat(blocks): add e-commerce dashboard * feat(blocks): add products pages * style(blocks): run prettier * feat(www): update dashboard-05 * feat(www): update gap for dashboard-05 * feat(www): update dashboards * fix(www): review a11y for new blocks * fix(blocks): a11y for dashboard-07 * fix(www): blocks background * chore: update registry
1 parent 9813c59 commit f47bb97

File tree

11 files changed

+4041
-21
lines changed

11 files changed

+4041
-21
lines changed

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v18.17.0
1+
v20.5.1

apps/www/__registry__/index.tsx

+54
Original file line numberDiff line numberDiff line change
@@ -1697,6 +1697,33 @@ export const Index: Record<string, any> = {
16971697
category: "undefined",
16981698
subcategory: "undefined",
16991699
},
1700+
"dashboard-05": {
1701+
name: "dashboard-05",
1702+
type: "components:block",
1703+
registryDependencies: ["badge","breadcrumb","button","card","dropdown-menu","input","pagination","progress","separator","sheet","table","tabs","tooltip"],
1704+
component: React.lazy(() => import("@/registry/default/block/dashboard-05")),
1705+
files: ["registry/default/block/dashboard-05.tsx"],
1706+
category: "Application",
1707+
subcategory: "Dashboard",
1708+
},
1709+
"dashboard-06": {
1710+
name: "dashboard-06",
1711+
type: "components:block",
1712+
registryDependencies: ["badge","breadcrumb","button","card","dropdown-menu","input","sheet","table","tabs","tooltip"],
1713+
component: React.lazy(() => import("@/registry/default/block/dashboard-06")),
1714+
files: ["registry/default/block/dashboard-06.tsx"],
1715+
category: "Application",
1716+
subcategory: "Dashboard",
1717+
},
1718+
"dashboard-07": {
1719+
name: "dashboard-07",
1720+
type: "components:block",
1721+
registryDependencies: ["badge","breadcrumb","button","card","dropdown-menu","input","pagination","progress","separator","sheet","table","tabs","tooltip"],
1722+
component: React.lazy(() => import("@/registry/default/block/dashboard-07")),
1723+
files: ["registry/default/block/dashboard-07.tsx"],
1724+
category: "Application",
1725+
subcategory: "Dashboard",
1726+
},
17001727
"dashboard-01": {
17011728
name: "dashboard-01",
17021729
type: "components:block",
@@ -3462,6 +3489,33 @@ export const Index: Record<string, any> = {
34623489
category: "undefined",
34633490
subcategory: "undefined",
34643491
},
3492+
"dashboard-05": {
3493+
name: "dashboard-05",
3494+
type: "components:block",
3495+
registryDependencies: ["badge","breadcrumb","button","card","dropdown-menu","input","pagination","progress","separator","sheet","table","tabs","tooltip"],
3496+
component: React.lazy(() => import("@/registry/new-york/block/dashboard-05")),
3497+
files: ["registry/new-york/block/dashboard-05.tsx"],
3498+
category: "Application",
3499+
subcategory: "Dashboard",
3500+
},
3501+
"dashboard-06": {
3502+
name: "dashboard-06",
3503+
type: "components:block",
3504+
registryDependencies: ["badge","breadcrumb","button","card","dropdown-menu","input","sheet","table","tabs","tooltip"],
3505+
component: React.lazy(() => import("@/registry/new-york/block/dashboard-06")),
3506+
files: ["registry/new-york/block/dashboard-06.tsx"],
3507+
category: "Application",
3508+
subcategory: "Dashboard",
3509+
},
3510+
"dashboard-07": {
3511+
name: "dashboard-07",
3512+
type: "components:block",
3513+
registryDependencies: ["badge","breadcrumb","button","card","dropdown-menu","input","pagination","progress","separator","sheet","table","tabs","tooltip"],
3514+
component: React.lazy(() => import("@/registry/new-york/block/dashboard-07")),
3515+
files: ["registry/new-york/block/dashboard-07.tsx"],
3516+
category: "Application",
3517+
subcategory: "Dashboard",
3518+
},
34653519
"dashboard-01": {
34663520
name: "dashboard-01",
34673521
type: "components:block",

apps/www/app/(blocks)/blocks/[style]/[name]/page.tsx

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
import { Metadata } from "next"
2+
import { notFound } from "next/navigation"
3+
14
import { siteConfig } from "@/config/site"
25
import { getAllBlockIds, getBlock } from "@/lib/blocks"
3-
import { absoluteUrl } from "@/lib/utils"
6+
import { absoluteUrl, cn } from "@/lib/utils"
47
import { Style, styles } from "@/registry/styles"
58

69
import "@/styles/mdx.css"
7-
import { Metadata } from "next"
8-
import { notFound } from "next/navigation"
10+
import "public/registry/themes.css"
911

1012
export async function generateMetadata({
1113
params,
@@ -79,7 +81,7 @@ export default async function BlockPage({
7981
const Component = block.component
8082

8183
return (
82-
<div className={block.container?.className || ""}>
84+
<div className={cn(block.container?.className || "", "theme-zinc")}>
8385
<Component />
8486
</div>
8587
)

apps/www/components/block-preview.tsx

+3-16
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export function BlockPreview({ block }: { block: Block }) {
6262
>
6363
<div className="flex flex-col items-center gap-4 sm:flex-row">
6464
<div className="flex items-center gap-2">
65-
<TabsList className="hidden sm:flex">
65+
<TabsList className="hidden h-8 sm:flex">
6666
<TabsTrigger value="preview">Preview</TabsTrigger>
6767
<TabsTrigger value="code">Code</TabsTrigger>
6868
</TabsList>
@@ -75,19 +75,6 @@ export function BlockPreview({ block }: { block: Block }) {
7575
<a href={`#${block.name}`}>
7676
<Badge variant="outline">{block.name}</Badge>
7777
</a>
78-
<Popover>
79-
<PopoverTrigger className="hidden text-muted-foreground hover:text-foreground sm:flex">
80-
<Info className="h-3.5 w-3.5" />
81-
<span className="sr-only">Block description</span>
82-
</PopoverTrigger>
83-
<PopoverContent
84-
side="right"
85-
sideOffset={10}
86-
className="text-sm"
87-
>
88-
{block.description}
89-
</PopoverContent>
90-
</Popover>
9178
</div>
9279
</div>
9380
</div>
@@ -116,7 +103,7 @@ export function BlockPreview({ block }: { block: Block }) {
116103
<Tablet className="h-3.5 w-3.5" />
117104
</ToggleGroupItem>
118105
<ToggleGroupItem
119-
value="25"
106+
value="30"
120107
className="h-[22px] w-[22px] rounded-sm p-0"
121108
>
122109
<Smartphone className="h-3.5 w-3.5" />
@@ -177,7 +164,7 @@ export function BlockPreview({ block }: { block: Block }) {
177164
ref={ref}
178165
className="relative rounded-lg border bg-background transition-all"
179166
defaultSize={100}
180-
minSize={25}
167+
minSize={30}
181168
>
182169
{isLoading ? (
183170
<div className="absolute inset-0 z-10 flex h-[--container-height] w-full items-center justify-center gap-2 text-sm text-muted-foreground">

apps/www/registry/blocks.ts

+63
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,69 @@
11
import { Registry } from "@/registry/schema"
22

33
export const blocks: Registry = [
4+
{
5+
name: "dashboard-05",
6+
type: "components:block",
7+
registryDependencies: [
8+
"badge",
9+
"breadcrumb",
10+
"button",
11+
"card",
12+
"dropdown-menu",
13+
"input",
14+
"pagination",
15+
"progress",
16+
"separator",
17+
"sheet",
18+
"table",
19+
"tabs",
20+
"tooltip",
21+
],
22+
files: ["block/dashboard-05.tsx"],
23+
category: "Application",
24+
subcategory: "Dashboard",
25+
},
26+
{
27+
name: "dashboard-06",
28+
type: "components:block",
29+
registryDependencies: [
30+
"badge",
31+
"breadcrumb",
32+
"button",
33+
"card",
34+
"dropdown-menu",
35+
"input",
36+
"sheet",
37+
"table",
38+
"tabs",
39+
"tooltip",
40+
],
41+
files: ["block/dashboard-06.tsx"],
42+
category: "Application",
43+
subcategory: "Dashboard",
44+
},
45+
{
46+
name: "dashboard-07",
47+
type: "components:block",
48+
registryDependencies: [
49+
"badge",
50+
"breadcrumb",
51+
"button",
52+
"card",
53+
"dropdown-menu",
54+
"input",
55+
"pagination",
56+
"progress",
57+
"separator",
58+
"sheet",
59+
"table",
60+
"tabs",
61+
"tooltip",
62+
],
63+
files: ["block/dashboard-07.tsx"],
64+
category: "Application",
65+
subcategory: "Dashboard",
66+
},
467
{
568
name: "dashboard-01",
669
type: "components:block",

0 commit comments

Comments
 (0)