Skip to content

Commit 7465021

Browse files
committed
feat: added utils in docs
1 parent ba1a477 commit 7465021

File tree

5 files changed

+36
-3
lines changed

5 files changed

+36
-3
lines changed

.github/workflows/deploy.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: "Deploy to VPS"
22

33
on:
4-
release:
5-
types: [published]
4+
push:
5+
branches:
6+
[main]
67

78
jobs:
89
build-and-deploy:

app/layout.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,21 @@ const archivoBlack = Archivo_Black({
77
subsets: ["latin"],
88
weight: "400",
99
variable: "--font-head",
10+
display: "swap",
1011
});
1112

1213
const shareTech = Share_Tech({
1314
subsets: ["latin"],
1415
weight: "400",
1516
variable: "--font-sans",
17+
display: "swap",
1618
});
1719

1820
const shareTechMono = Share_Tech_Mono({
1921
subsets: ["latin"],
2022
weight: "400",
2123
variable: "--font-mono",
24+
display: "swap",
2225
});
2326

2427
export const metadata: Metadata = {

components/MDX.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const components = {
2929
}: React.HTMLAttributes<HTMLElement>) => (
3030
<code
3131
className={cn(
32-
"relative rounded bg-[#282A36] py-1 px-2 text-primary-500 text-sm",
32+
"relative rounded bg-[#282A36] p-1 text-primary-500 text-sm",
3333
className
3434
)}
3535
{...props}

config/navigation.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { INavigationConfig } from "@/types";
22

33
const componentsRoute = "/docs/components";
4+
const utilsRoute = "/docs/utils";
45

56
export const navConfig: INavigationConfig = {
67
topNavItems: [
@@ -26,5 +27,9 @@ export const navConfig: INavigationConfig = {
2627
{ title: "Typography", href: `${componentsRoute}/typography` },
2728
],
2829
},
30+
{
31+
title: "Utilities",
32+
children: [{ title: "cn", href: `${utilsRoute}/cn` }],
33+
},
2934
],
3035
};

content/docs/utils/cn.mdx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: cn
3+
description: A utilily function that saves you from style conflicts.
4+
lastUpdated: 17 Oct, 2024
5+
---
6+
7+
The `cn` utility function combines `clsx` and `tw-merge`.
8+
This enables you to construct className strings conditionally without having to worry about Tailwind CSS style conflicts.
9+
10+
<br />
11+
<br />
12+
13+
## Installation
14+
15+
#### 1. Copy the code 👇 into your `lib/utils.ts` file:
16+
17+
```ts
18+
import clsx from "clsx";
19+
import { ClassNameValue, twMerge } from "tailwind-merge";
20+
21+
export function cn(...classes: ClassNameValue[]) {
22+
return twMerge(clsx(classes));
23+
}
24+
```

0 commit comments

Comments
 (0)