Skip to content

Commit 342f701

Browse files
authored
chore(registry): 🛠️ change registry.json docs mapping (#67)
- Enhance filtering logic to only include UI components in documentation - Update registry dependencies for better integration
1 parent e6e718b commit 342f701

File tree

2 files changed

+57
-13
lines changed

2 files changed

+57
-13
lines changed

apps/registry/app/docs/layout.tsx

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,27 @@ export default function DocsLayout({
77
}: {
88
children: React.ReactNode;
99
}) {
10-
const categoryGroups = registry.items.reduce<
11-
Record<string, Array<{ href: string; title: string }>>
12-
>((acc, item) => {
13-
const category = item.categories[0] || "uncategorized";
14-
if (!acc[category]) {
15-
acc[category] = [];
16-
}
10+
const categoryGroups = registry.items
11+
.filter((item) => item.type === "registry:ui")
12+
.reduce<Record<string, Array<{ href: string; title: string }>>>(
13+
(acc, item) => {
14+
const category = item?.categories?.[0];
15+
if (!category) {
16+
return acc;
17+
}
1718

18-
acc[category].push({
19-
title: item.title,
20-
href: `/docs/${item.name}`,
21-
});
22-
return acc;
23-
}, {});
19+
if (!acc[category]) {
20+
acc[category] = [];
21+
}
22+
23+
acc[category].push({
24+
title: item.title,
25+
href: `/docs/${item.name}`,
26+
});
27+
return acc;
28+
},
29+
{},
30+
);
2431

2532
const items = [
2633
{

apps/registry/registry.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,45 @@
33
"name": "acme",
44
"homepage": "https://acme.com",
55
"items": [
6+
{
7+
"name": "utils",
8+
"type": "registry:lib",
9+
"title": "Utils",
10+
"description": "A utility component",
11+
"dependencies": ["tailwind-merge", "clsx"],
12+
"files": [
13+
{
14+
"path": "registry/web/default/lib/utils.ts",
15+
"type": "registry:lib"
16+
}
17+
]
18+
},
19+
{
20+
"name": "icon",
21+
"type": "registry:ui",
22+
"title": "Icon",
23+
"description": "An icon component",
24+
"dependencies": ["@radix-ui/react-slot", "class-variance-authority"],
25+
"registryDependencies": ["https://frappe-ui-react.tmls.dev/r/utils.json"],
26+
"files": [
27+
{
28+
"path": "registry/web/default/ui/icon.tsx",
29+
"type": "registry:ui"
30+
}
31+
],
32+
"categories": ["primitives"]
33+
},
634
{
735
"name": "button",
836
"type": "registry:ui",
937
"title": "Button",
1038
"description": "A button component",
1139
"dependencies": ["@radix-ui/react-slot", "class-variance-authority"],
40+
"registryDependencies": [
41+
"https://frappe-ui-react.tmls.dev/r/utils.json",
42+
"https://frappe-ui-react.tmls.dev/r/icon.json",
43+
"https://frappe-ui-react.tmls.dev/r/button-group.json"
44+
],
1245
"files": [
1346
{
1447
"path": "registry/web/default/ui/button.tsx",
@@ -26,6 +59,10 @@
2659
"title": "Button Group",
2760
"description": "A button group component",
2861
"dependencies": ["@radix-ui/react-slot", "class-variance-authority"],
62+
"registryDependencies": [
63+
"https://frappe-ui-react.tmls.dev/r/utils.json",
64+
"https://frappe-ui-react.tmls.dev/r/button.json"
65+
],
2966
"files": [
3067
{
3168
"path": "registry/web/default/ui/button-group.tsx",

0 commit comments

Comments
 (0)