Skip to content

Commit 27fad84

Browse files
committed
📃 typography docs
1 parent 218523a commit 27fad84

File tree

5 files changed

+74
-10
lines changed

5 files changed

+74
-10
lines changed

components/MDX.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import { H1, H2, H3, H4, H5, H6 } from "@/packages/ui";
22
import { useMDXComponent } from "next-contentlayer/hooks";
3-
import React from "react";
3+
import React, { HTMLAttributes } from "react";
44

55
const components = {
66
h1: H1,
7-
h2: H2,
7+
h2: (props: HTMLAttributes<HTMLHeadingElement>) => (
8+
<H2 className="mb-2" {...props} />
9+
),
810
h3: H3,
911
h4: H4,
1012
h5: H5,

config/components.ts

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,27 @@ export const componentConfig = {
8181
className="px-4 py-2 w-full border-2 border-black shadow-md transition focus:outline-none focus:shadow-xs"
8282
/>`,
8383
},
84-
"textarea-style-default": {
85-
name: "textarea-style-default",
86-
preview: lazy(() => import("@/preview/components/textarea-style-default")),
87-
codeHtml: `<textarea
88-
placeholder="Enter text..."
89-
rows="4"
90-
class="px-4 py-2 w-full border-2 border-black shadow-md transition focus:outline-none focus:shadow-xs"
91-
/>`,
84+
"typography-headings": {
85+
name: "typography-headings",
86+
preview: lazy(() => import("@/preview/components/typography-headings")),
87+
codeHtml: `<div className="space-y-4">
88+
<h1 className="font-head text-5xl lg:text-6xl font-bold">This is H1</h1>
89+
<h2 className="font-head text-4xl font-semibold">This is H2</h2>
90+
<h3 className="font-head text-2xl font-semibold">This is H3</h3>
91+
<h4 className="font-head text-xl font-medium">This is H4</h4>
92+
<h5 className="font-head text-lg font-medium">This is H5</h5>
93+
<h6 className="font-head font-medium">This is H6</h6>
94+
</div>`,
95+
},
96+
"typography-p": {
97+
name: "typography-p",
98+
preview: lazy(() => import("@/preview/components/typography-p")),
99+
codeHtml: `<p className="font-sans">
100+
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Quaerat eos,
101+
doloremque inventore nesciunt quo sequi veniam impedit alias libero
102+
dolorem tempore quia esse fugit fuga iste aliquam expedita molestias
103+
iusto?
104+
</p>`,
92105
},
93106
},
94107
};
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: Typography
3+
description: Show your texts in different styles. 💅
4+
lastUpdated: 30 Sep, 2024
5+
---
6+
7+
import {ComponentShowcase} from "@/components"
8+
9+
## Headings
10+
<hr/>
11+
<br/>
12+
13+
<ComponentShowcase name="typography-headings" />
14+
15+
<br/>
16+
<br/>
17+
<br/>
18+
19+
## Paragraph
20+
<hr/>
21+
<br/>
22+
23+
<ComponentShowcase name="typography-p" />
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from "react";
2+
3+
export default function TypographyHeadings() {
4+
return (
5+
<div className="space-y-4">
6+
<h1 className="font-head text-5xl lg:text-6xl font-bold">This is H1</h1>
7+
<h2 className="font-head text-4xl font-semibold">This is H2</h2>
8+
<h3 className="font-head text-2xl font-semibold">This is H3</h3>
9+
<h4 className="font-head text-xl font-medium">This is H4</h4>
10+
<h5 className="font-head text-lg font-medium">This is H5</h5>
11+
<h6 className="font-head font-medium">This is H6</h6>
12+
</div>
13+
);
14+
}

preview/components/typography-p.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from "react";
2+
3+
export default function TypographyParagraph() {
4+
return (
5+
<p className="font-sans">
6+
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Quaerat eos,
7+
doloremque inventore nesciunt quo sequi veniam impedit alias libero
8+
dolorem tempore quia esse fugit fuga iste aliquam expedita molestias
9+
iusto?
10+
</p>
11+
);
12+
}

0 commit comments

Comments
 (0)