Skip to content

Commit da7eee4

Browse files
committed
fix: minor fixes
1 parent a533823 commit da7eee4

File tree

12 files changed

+60
-30
lines changed

12 files changed

+60
-30
lines changed

content/blocks/index.mdx

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: Blocks
3+
description: Copy and paste blocks for your React app
4+
---
5+
6+
Beautifully designed blocks that you can copy and paste into your apps. Accessible. Customizable. Open Source, crafted with Tailwind CSS, fully responsive.
7+
If you think it's missing a block, please [open an issue](https://github.com/mehdibha/rcopy/issues/new).

content/components/animations/sparkle-button.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: Sparkle button
33
description: A beautiful sparkle animation button
44
video: /previews/components/sparkle-button.mp4
5+
label: New
56
---
67

78
<ComponentPreview name="demos/components/animations/sparkle-button" />
File renamed without changes.

scripts/build-docs-config.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,20 @@ const getCategoryItems = (category: string) => {
88
return getAllCategoryDocs(category).map((category) => ({
99
title: category.title,
1010
href: category.href,
11+
label: category.label,
1112
}));
1213
};
1314

1415
const docsConfig: DocsConfig = {
1516
sidebarNav: [
1617
{
1718
title: "Getting Started",
18-
items: [
19-
{
20-
title: "Introduction",
21-
href: "/getting-started",
22-
},
23-
],
19+
slug: "getting-started",
20+
items: getCategoryItems("getting-started"),
2421
},
2522
{
2623
title: "Components",
24+
slug: "components",
2725
items: [
2826
{
2927
title: "All components",
@@ -41,6 +39,7 @@ const docsConfig: DocsConfig = {
4139
},
4240
{
4341
title: "Blocks",
42+
slug: "blocks",
4443
items: [
4544
{
4645
title: "All blocks",
@@ -62,6 +61,7 @@ const docsConfig: DocsConfig = {
6261
},
6362
{
6463
title: "Hooks",
64+
slug: "hooks",
6565
items: [
6666
{
6767
title: "All hooks",
@@ -72,6 +72,7 @@ const docsConfig: DocsConfig = {
7272
},
7373
{
7474
title: "Icons",
75+
slug: "icons",
7576
items: [
7677
{
7778
title: "All icons",
@@ -82,6 +83,7 @@ const docsConfig: DocsConfig = {
8283
},
8384
{
8485
title: "Templates",
86+
slug: "templates",
8587
items: [
8688
{
8789
title: "All templates",

src/app/(docs)/[...slug]/page.tsx

+6-4
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ export default async function Page({ params }: PageProps) {
6161
"xl:grid xl:grid-cols-[1fr_220px]": !!doc.toc.items, // !!doc.toc
6262
})}
6363
>
64-
<div className="mx-auto w-full min-w-0 pt-6">
64+
<div className="mx-auto w-full min-w-0 pt-6">
6565
{metadata.breadcrumbs.length > 1 && (
66-
<Breadcrumb>
66+
<Breadcrumb className="mb-2">
6767
<BreadcrumbList>
6868
{metadata.breadcrumbs.map((breadcrumb, index) => (
6969
<React.Fragment key={index}>
@@ -86,7 +86,7 @@ export default async function Page({ params }: PageProps) {
8686
</BreadcrumbList>
8787
</Breadcrumb>
8888
)}
89-
<h1 className="mt-2 text-4xl font-bold">{metadata.title}</h1>
89+
<h1 className="text-4xl font-bold">{metadata.title}</h1>
9090
<p className="mt-2 text-muted-foreground">{metadata.description}</p>
9191
{categories && categories.length > 0 && (
9292
<div className="mt-6 flex flex-wrap gap-4">
@@ -165,7 +165,9 @@ const DataGrid = ({ type, items }: { type: string; items: Item[] }) => {
165165
/>
166166
</ScrollArea>
167167
) : (
168-
<p className="text-muted-foreground">No thumbnail</p>
168+
<div className="flex aspect-video w-full items-center justify-center bg-card/50">
169+
<p className="text-muted-foreground">No thumbnail</p>
170+
</div>
169171
)}
170172
</div>
171173
)}

src/components/docs-sidebar.tsx

+12-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ export function DocsSidebar({ items }: DocsSidebarProps) {
2222
return items.length > 0 ? (
2323
<div className="w-full space-y-4 pb-10 pt-6 text-sm">
2424
{items.map((item, index) => (
25-
<Category key={index} title={item.title} items={item.items} pathname={pathname} />
25+
<Category
26+
key={index}
27+
title={item.title}
28+
items={item.items}
29+
slug={item.slug}
30+
pathname={pathname}
31+
/>
2632
))}
2733
</div>
2834
) : null;
@@ -32,8 +38,8 @@ interface CategoryProps extends TCategory {
3238
pathname: string;
3339
}
3440

35-
const Category = ({ title, items, pathname }: CategoryProps) => {
36-
const [open, setOpen] = React.useState(true);
41+
const Category = ({ title, slug, items, pathname }: CategoryProps) => {
42+
const [open, setOpen] = React.useState(pathname.startsWith(`/${slug}`));
3743

3844
return (
3945
<Collapsible open={open} onOpenChange={setOpen}>
@@ -57,7 +63,7 @@ const Category = ({ title, items, pathname }: CategoryProps) => {
5763
}
5864
)}
5965
>
60-
<span className="block duration-100 group-hover:translate-x-1">
66+
<span className="block duration-100 group-hover:translate-x-0.5">
6167
{item.title}
6268
</span>
6369
</Link>
@@ -83,10 +89,10 @@ const Category = ({ title, items, pathname }: CategoryProps) => {
8389
}
8490
)}
8591
>
86-
<span className="block transition-transform duration-100 group-hover:translate-x-1">
92+
<span className="block transition-transform duration-100 group-hover:translate-x-0.5">
8793
{subItem.title}
8894
{subItem.label && (
89-
<span className="ml-2 rounded-md bg-[#adfa1d] px-1.5 py-0.5 text-xs leading-none text-black no-underline group-hover:no-underline">
95+
<span className="ml-2 rounded-md bg-gradient px-1.5 py-0.5 text-xs leading-none text-black ">
9096
{subItem.label}
9197
</span>
9298
)}

src/components/header.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import React from "react";
44
import Image from "next/image";
55
import Link from "next/link";
6-
import { useSelectedLayoutSegments } from "next/navigation";
6+
import { usePathname } from "next/navigation";
77
import { motion, useAnimate } from "framer-motion";
88
import { MenuIcon, SearchIcon } from "lucide-react";
99
import { SearchDialog } from "@/components/search-dialog";
@@ -163,7 +163,7 @@ interface NavProps {
163163

164164
const Nav = (props: NavProps) => {
165165
const { items, direction = "row", onNavItemClick } = props;
166-
const segments = useSelectedLayoutSegments();
166+
const pathname = usePathname();
167167

168168
return (
169169
<nav
@@ -182,9 +182,7 @@ const Nav = (props: NavProps) => {
182182
{
183183
"cursor-default text-foreground/30 hover:text-foreground/30":
184184
item.disabled,
185-
"bg-foreground/10 text-foreground": segments[0]
186-
?.split("/")
187-
?.includes(item.href.slice(1, item.href.length)),
185+
"bg-foreground/10 text-foreground": pathname.startsWith(item.href),
188186
}
189187
)}
190188
onClick={onNavItemClick}

src/config/docs-config.ts

+16-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ export const docsConfig: DocsConfig = {
66
sidebarNav: [
77
{
88
title: "Getting Started",
9-
items: [{ title: "Introduction", href: "/getting-started" }],
9+
slug: "getting-started",
10+
items: [{ title: "Introduction", href: "/getting-started/introduction" }],
1011
},
1112
{
1213
title: "Components",
14+
slug: "components",
1315
items: [
1416
{ title: "All components", href: "/components" },
1517
{
@@ -66,13 +68,18 @@ export const docsConfig: DocsConfig = {
6668
{
6769
title: "Animations",
6870
items: [
69-
{ title: "Sparkle button", href: "/components/animations/sparkle-button" },
71+
{
72+
title: "Sparkle button",
73+
href: "/components/animations/sparkle-button",
74+
label: "New",
75+
},
7076
],
7177
},
7278
],
7379
},
7480
{
7581
title: "Blocks",
82+
slug: "blocks",
7683
items: [
7784
{ title: "All blocks", href: "/blocks" },
7885
{
@@ -85,13 +92,18 @@ export const docsConfig: DocsConfig = {
8592
},
8693
{
8794
title: "Hooks",
95+
slug: "hooks",
8896
items: [
8997
{ title: "All hooks", href: "/hooks" },
9098
{ title: "useBattery", href: "/hooks/use-battery" },
9199
{ title: "useDebounce", href: "/hooks/use-debounce" },
92100
],
93101
},
94-
{ title: "Icons", items: [{ title: "All icons", href: "/icons" }] },
95-
{ title: "Templates", items: [{ title: "All templates", href: "/templates" }] },
102+
{ title: "Icons", slug: "icons", items: [{ title: "All icons", href: "/icons" }] },
103+
{
104+
title: "Templates",
105+
slug: "templates",
106+
items: [{ title: "All templates", href: "/templates" }],
107+
},
96108
],
97109
};

src/config/site-config.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ export const siteConfig = {
2929
header: {
3030
nav: {
3131
links: [
32-
{ href: "/getting-started", label: "Docs" },
32+
{ href: "/getting-started/introduction", label: "Docs" },
3333
{ href: "/components", label: "Components" },
34-
{ href: "/components", label: "Blocks" },
34+
{ href: "/blocks", label: "Blocks" },
3535
{ href: "/hooks", label: "Hooks" },
3636
{ href: "/icons", label: "Icons" },
3737
{ href: "/templates", label: "Templates" },

src/styles/globals.css

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
}
2828

2929
.dark {
30-
--background: 240 10% 8%;
30+
--background: 240 10% 10%;
3131
--foreground: 0 0% 80%;
3232
--card: 240 10% 15%;
3333
--card-foreground: 0 0% 98%;
@@ -80,11 +80,11 @@
8080
}
8181

8282
.category:before {
83-
@apply absolute top-0 left-0 h-2 w-2 rounded-full bg-muted content-[''] -ml-1 mt-1;
83+
@apply absolute left-0 top-0 -ml-1 mt-1 h-2 w-2 rounded-full bg-muted content-[''];
8484
}
8585

8686
.category:after {
87-
@apply absolute top-3 left-0 h-2 w-[1px] bg-muted content-[''];
87+
@apply absolute left-0 top-3 h-2 w-[1px] bg-muted content-[''];
8888
}
8989

9090
@media (max-width: 640px) {

src/types/nav.ts

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ interface SubCategory {
1313

1414
export interface Category {
1515
title: string;
16+
slug: string;
1617
items: (Item | SubCategory)[];
1718
}
1819

src/utils/docs.ts

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ interface DocFrontmatter {
1414
video?: string;
1515
keywords?: string[];
1616
externalLink?: string;
17+
label?: string;
1718
}
1819

1920
interface DocMetadata {

0 commit comments

Comments
 (0)