Skip to content

Commit 459d791

Browse files
committed
added links in docs
1 parent feda5bc commit 459d791

File tree

6 files changed

+55
-5
lines changed

6 files changed

+55
-5
lines changed

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

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { format } from "date-fns";
55
import MDX from "@/components/MDX";
66
import { Text } from "@/packages/ui";
77
import { Metadata } from "next";
8+
import { MoveRightIcon, MoveUpRightIcon } from "lucide-react";
89

910
interface IProps {
1011
params: { slug: string[] };
@@ -45,9 +46,31 @@ export default function page({ params }: IProps) {
4546

4647
return (
4748
<div className="space-y-12 py-8">
48-
<div className="border-b border-black pb-4">
49+
<div className="border-b border-black pb-6">
4950
<Text as="h2">{doc.title}</Text>
5051
<p className="text-lg text-muted">{doc.description}</p>
52+
{doc.links && (
53+
<div className="flex space-x-4 text-sm mt-4">
54+
{doc.links?.api_reference && (
55+
<a
56+
className="flex items-center bg-gray-200 px-1.5 py-.5"
57+
href={doc.links.api_reference}
58+
target="_blank"
59+
>
60+
API Reference <MoveUpRightIcon className="h-3 w-3 ml-1" />
61+
</a>
62+
)}
63+
{doc.links && doc.links?.source && (
64+
<a
65+
className="flex items-center bg-gray-200 px-1.5 py-.5"
66+
href={doc.links.source}
67+
target="_blank"
68+
>
69+
Source <MoveUpRightIcon className="h-3 w-3 ml-1" />
70+
</a>
71+
)}
72+
</div>
73+
)}
5174
</div>
5275
<div>
5376
<MDX code={doc.body.code} />

content/docs/components/accordion.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
title: Accordion
33
description: This collapsible component let's your users read only the content they care about. 😌
44
lastUpdated: 19 Oct, 2024
5+
links:
6+
api_reference: https://www.radix-ui.com/primitives/docs/components/accordion#api-reference
7+
source: https://github.com/Logging-Stuff/RetroUI/blob/main/packages/ui/Accordions/Accordion.tsx
58
---
69

710
<ComponentShowcase name="accordion-style-default" />

content/docs/components/button.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
---
22
title: Button
33
description: This bold button makes sure your users click on it and perform the actions you want! 🚀
4-
lastUpdated: 13 Oct, 2024
4+
lastUpdated: 04 Nov, 2024
5+
links:
6+
source: https://github.com/Logging-Stuff/RetroUI/blob/main/packages/ui/Buttons/Button.tsx
57
---
68

79
<ComponentShowcase name="button-style-default" />

content/docs/components/dialog.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
---
22
title: Dialog
33
description: An impactful dialog that ensures your important messages and actions get the attention they deserve! 💬✨
4-
lastUpdated: 26 Oct, 2024
4+
lastUpdated: 04 Nov, 2024
5+
links:
6+
api_reference: https://www.radix-ui.com/primitives/docs/components/dialog#api-reference
7+
source: https://github.com/Logging-Stuff/RetroUI/blob/main/packages/ui/Dialog/Dialog.tsx
58
---
69

710
<ComponentShowcase name="dialog-style-default" />

contentlayer.config.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
11
import path from "path";
22
import fs from "fs";
3-
import { defineDocumentType, makeSource } from "contentlayer/source-files";
3+
import {
4+
defineDocumentType,
5+
defineNestedType,
6+
makeSource,
7+
} from "contentlayer/source-files";
48
import { visit } from "unist-util-visit";
59
import rehypePrettyCode from "rehype-pretty-code";
610
import rehypeSlug from "rehype-slug";
711
import { u } from "unist-builder";
812
import { UnistNode } from "./types/unist";
913
import { componentConfig } from "./config";
1014

15+
const Links = defineNestedType(() => {
16+
return {
17+
name: "Links",
18+
fields: {
19+
source: { type: "string", required: false },
20+
api_reference: { type: "string", required: false },
21+
},
22+
};
23+
});
24+
1125
export const Doc = defineDocumentType(() => ({
1226
name: "Doc",
1327
filePathPattern: `docs/**/*.mdx`,
@@ -16,6 +30,11 @@ export const Doc = defineDocumentType(() => ({
1630
title: { type: "string", required: true },
1731
description: { type: "string", required: true },
1832
lastUpdated: { type: "date", required: true },
33+
links: {
34+
type: "nested",
35+
of: Links,
36+
required: false,
37+
},
1938
},
2039
computedFields: {
2140
url: {

packages/ui/Badges/Badge.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import React, { HTMLAttributes } from "react";
55
const badgeVariants = cva("font-semibold ", {
66
variants: {
77
variant: {
8-
default: "bg-gray-300 text-gray-700",
8+
default: "bg-gray-200 text-gray-700",
99
outline: "outline outline-2 outline-black text-black",
1010
solid: "bg-black text-white",
1111
surface: "outline outline-2 bg-primary-300 text-black",

0 commit comments

Comments
 (0)