Skip to content

Commit c15bbb3

Browse files
authored
feat: add Discord icon in top navbar (#45)
1 parent 578c956 commit c15bbb3

File tree

4 files changed

+47
-3
lines changed

4 files changed

+47
-3
lines changed

package-lock.json

Lines changed: 23 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/icons/discord.svg

Lines changed: 8 additions & 0 deletions
Loading

src/app/docs/layout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { source } from "@/lib/source";
22
import { DocsLayout } from "fumadocs-ui/layouts/docs";
3-
import { baseOptions } from "@/lib/layout.shared";
3+
import { baseOptions, sharedLinks } from "@/lib/layout.shared";
44

55
export default function Layout({ children }: LayoutProps<"/docs">) {
66
const base = baseOptions();
@@ -22,6 +22,7 @@ export default function Layout({ children }: LayoutProps<"/docs">) {
2222
<DocsLayout
2323
tree={source.pageTree}
2424
{...base}
25+
links={sharedLinks}
2526
nav={docsNav}
2627
sidebar={{
2728
collapsible: true,

src/lib/layout.shared.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { BaseLayoutProps } from "fumadocs-ui/layouts/shared";
22
import type { LinkItemType } from "fumadocs-ui/layouts/shared";
33
import Link from "next/link";
4+
import Image from "next/image";
45

56
export function baseOptions(): BaseLayoutProps {
67
return {
@@ -9,9 +10,11 @@ export function baseOptions(): BaseLayoutProps {
910
enabled: true,
1011
children: (
1112
<Link href="/" className="inline-flex items-center gap-2 font-semibold text-lg">
12-
<img
13+
<Image
1314
src="https://cdn.casbin.org/img/casbin_logo_1024x256.png"
1415
alt="Casbin"
16+
width={128}
17+
height={32}
1518
className="h-8 object-contain"
1619
/>
1720
</Link>
@@ -53,4 +56,14 @@ export const sharedLinks: LinkItemType[] = [
5356
url: "/help",
5457
text: "Help",
5558
},
59+
{
60+
type: "icon",
61+
url: "https://discord.gg/S5UjpzGZjN",
62+
text: "Discord",
63+
label: "Discord",
64+
icon: (
65+
<Image src="/icons/discord.svg" alt="Discord" width={20} height={20} className="size-5" />
66+
),
67+
external: true,
68+
},
5669
];

0 commit comments

Comments
 (0)