Skip to content

Commit

Permalink
feat: ✨ migrate to fumadocs
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderl19 committed Oct 1, 2024
1 parent 5a7e7b2 commit c3f1225
Show file tree
Hide file tree
Showing 133 changed files with 11,635 additions and 11,365 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
postcss.config.js
tailwind.config.js
4 changes: 1 addition & 3 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ const config = {
plugins: ["import", "@typescript-eslint"],
extends: [
"eslint:recommended",
"plugin:@next/next/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"prettier",
"next/core-web-vitals",
],
rules: {
"no-unused-vars": "off",
Expand Down
32 changes: 24 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
.idea/
.next/
.open-next/
.sst/
node_modules
# deps
/node_modules

# generated content
.contentlayer
.content-collections
.source

# test & build
/coverage
/.next/
/out/
/build
*.tsbuildinfo

# misc
.DS_Store
.env*
.pnpm-debug.log*
cdk.context.json
*.pem
/.pnp
.pnp.js
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# others
.env*.local
.vercel
next-env.d.ts
28 changes: 24 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
# ICSSC Projects Documentation
# my-app

## Powered by
This is a Next.js application generated with
[Create Fumadocs](https://github.com/fuma-nama/fumadocs).

- Nextra
- SST
Run development server:

```bash
npm run dev
# or
pnpm dev
# or
yarn dev
```

Open http://localhost:3000 with your browser to see the result.

## Learn More

To learn more about Next.js and Fumadocs, take a look at the following
resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js
features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
- [Fumadocs](https://fumadocs.vercel.app) - learn about Fumadocs
12 changes: 12 additions & 0 deletions app/(home)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { HomeLayout } from "fumadocs-ui/home-layout";
import type { ReactNode } from "react";

import { baseOptions } from "../layout.config";

export default function Layout({
children,
}: {
children: ReactNode;
}): React.ReactElement {
return <HomeLayout {...baseOptions}>{children}</HomeLayout>;
}
19 changes: 19 additions & 0 deletions app/(home)/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Link from "next/link";

export default function HomePage() {
return (
<main className="flex h-screen flex-col justify-center text-center">
<h1 className="mb-4 text-2xl font-bold">Hello World</h1>
<p className="text-fd-muted-foreground">
You can open{" "}
<Link
href="/docs"
className="text-fd-foreground font-semibold underline"
>
/docs
</Link>{" "}
and see the documentation.
</p>
</main>
);
}
13 changes: 13 additions & 0 deletions app/api/search/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { createSearchAPI } from "fumadocs-core/search/server";

import { source } from "@/app/source";

export const { GET } = createSearchAPI("advanced", {
indexes: source.getPages().map((page) => ({
title: page.data.title,
description: page.data.description,
structuredData: page.data.structuredData,
id: page.url,
url: page.url,
})),
});
47 changes: 47 additions & 0 deletions app/docs/[[...slug]]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import defaultMdxComponents from "fumadocs-ui/mdx";
import {
DocsPage,
DocsBody,
DocsDescription,
DocsTitle,
} from "fumadocs-ui/page";
import type { Metadata } from "next";
import { notFound } from "next/navigation";

import { source } from "@/app/source";

export default async function Page({
params,
}: {
params: { slug?: string[] };
}) {
const page = source.getPage(params.slug);

if (!page) notFound();

const MDX = page.data.body;

return (
<DocsPage toc={page.data.toc} full={page.data.full}>
<DocsTitle>{page.data.title}</DocsTitle>
<DocsDescription>{page.data.description}</DocsDescription>
<DocsBody>
<MDX components={{ ...defaultMdxComponents }} />
</DocsBody>
</DocsPage>
);
}

export async function generateStaticParams() {
return source.generateParams();
}

export function generateMetadata({ params }: { params: { slug?: string[] } }) {
const page = source.getPage(params.slug);
if (!page) notFound();

return {
title: page.data.title,
description: page.data.description,
} satisfies Metadata;
}
45 changes: 45 additions & 0 deletions app/docs/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { RootToggle } from "fumadocs-ui/components/layout/root-toggle";
import { DocsLayout } from "fumadocs-ui/layout";
import { BookOpenText, Brush, ScrollText } from "lucide-react";
import type { ReactNode } from "react";

import { baseOptions } from "../layout.config";

import { source } from "@/app/source";

export default function Layout({ children }: { children: ReactNode }) {
return (
<DocsLayout
sidebar={{
banner: (
<RootToggle
options={[
{
icon: <Brush />,
title: "Brand Guide",
description: "Logos, colors, topography, guidelines",
url: "/docs/brand",
},
{
icon: <BookOpenText />,
title: "Developer Docs",
description: "Public facing developer projects",
url: "/docs/developer",
},
{
icon: <ScrollText />,
title: "Contributor Docs",
description: "Internal documentation and design reasoning",
url: "/docs/contributor",
},
]}
/>
),
}}
tree={source.pageTree}
{...baseOptions}
>
{children}
</DocsLayout>
);
}
3 changes: 3 additions & 0 deletions app/global.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
2 changes: 1 addition & 1 deletion public/favicon.svg → app/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions app/layout.config.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { type HomeLayoutProps } from "fumadocs-ui/home-layout";

import { ICSSC } from "@/components/logos/ICSSC";

/**
* Shared layout configurations
*
* you can configure layouts individually from:
* Home Layout: app/(home)/layout.tsx
* Docs Layout: app/docs/layout.tsx
*/
export const baseOptions: HomeLayoutProps = {
nav: {
title: (
<>
<ICSSC />
<span className="font-medium [header_&]:text-[15px]">
ICS Student Council
</span>
</>
),
},
};
18 changes: 18 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import "./global.css";
import { RootProvider } from "fumadocs-ui/provider";
import { Inter } from "next/font/google";
import type { ReactNode } from "react";

const inter = Inter({
subsets: ["latin"],
});

export default function Layout({ children }: { children: ReactNode }) {
return (
<html lang="en" className={inter.className} suppressHydrationWarning>
<body>
<RootProvider>{children}</RootProvider>
</body>
</html>
);
}
30 changes: 30 additions & 0 deletions app/source.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { loader } from "fumadocs-core/source";
import { createMDXSource } from "fumadocs-mdx";
import { icons } from "lucide-react";
import { createElement } from "react";

import { docs, meta } from "@/.source";
import logos from "@/components/logos";
import { IconContainer } from "@/components/ui/IconContainer";

export const source = loader({
baseUrl: "/docs",
source: createMDXSource(docs, meta),
icon(icon) {
if (!icon) {
// You may set a default icon
return;
}

if (icon in logos) {
return createElement(IconContainer, {
icon: logos[icon as keyof typeof logos],
});
}
if (icon in icons) {
return createElement(IconContainer, {
icon: icons[icon as keyof typeof icons],
});
}
},
});
43 changes: 5 additions & 38 deletions theme.config.tsx → components/logos/ICSSC.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { DocsThemeConfig } from "nextra-theme-docs";

const config: DocsThemeConfig = {
logo: (
export function ICSSC() {
return (
<svg
width="24"
height="24"
Expand All @@ -10,40 +8,9 @@ const config: DocsThemeConfig = {
xmlns="http://www.w3.org/2000/svg"
>
<path
fill="currentColor"
fill="#FF87A6"
d="M568.349 198.139C567.601 200.916 498.185 328.375 496.423 331.419C495.034 333.821 488.84 343.593 487.185 344.875C485.476 346.156 480.083 349.04 477.307 349.253C474.53 349.413 394.381 348.612 394.381 348.612C394.381 348.612 391.391 354.112 391.764 354.646C392.138 355.18 393.046 356.141 393.046 356.141C393.046 356.141 461.928 356.302 465.079 357.049C468.229 357.797 473.836 357.423 476.986 361.908C480.137 366.34 481.632 365.219 482.913 376.059C484.248 386.845 483.928 398.325 483.287 405.427C482.593 413.437 480.938 419.097 479.549 423.048C476.666 431.111 472.714 437.092 468.069 440.402C463.37 443.766 445.161 448.625 436.992 450.815C428.769 453.057 408.317 458.29 390.803 458.29C373.289 458.29 364.425 457.543 349.527 456.048C334.629 454.552 327.047 454.072 321.227 452.31C314.872 450.387 303.499 447.184 297.305 448.679C291.164 450.174 288.494 452.31 281.766 454.179C275.092 456.048 262.063 456.635 256.082 456.421C251.864 456.261 236.859 456.582 224.151 453.484C212.19 450.601 202.472 444.247 200.282 443.019C191.365 437.786 184.957 432.873 177.695 425.985C173.317 421.82 172.302 422.087 168.725 418.883C167.39 417.655 165.36 423.742 160.982 429.99C155.589 437.732 150.196 441.737 145.871 445.261C135.298 453.912 122.643 458.077 113.672 458.29C104.755 458.45 91.0323 456.581 83.6093 453.004C77.7363 450.227 64.7074 440.349 58.1924 434.155C48.2074 424.703 31.4943 403.131 27.3293 395.495C13.6063 370.025 5.91736 351.816 4.04836 339.161C-1.45164 302.798 -0.27664 283.148 1.37836 267.342C3.62136 245.77 12.2174 218.377 15.6884 208.552C20.3874 195.416 31.7614 178.97 34.9654 173.683C38.1693 168.344 43.1344 161.883 45.2704 158.946C46.3384 157.451 52.1593 151.043 54.0273 148.8C54.6153 148.106 57.6584 144.902 57.6584 144.902C57.6584 144.902 63.2123 139.563 63.7994 139.082C65.2943 137.694 69.5663 134.063 71.9153 132.674C78.3773 128.883 81.7414 133.208 82.3284 135.238C82.6484 136.572 83.1293 137.373 82.5423 141.859C81.6873 148.32 81.1003 150.776 80.8333 154.621C80.7263 155.956 80.4594 158.465 80.3524 160.548C80.2454 162.63 80.3524 170.48 80.3524 171.921C80.4064 174.004 81.0464 179.984 81.3674 182.12C81.6874 184.256 82.1684 188.902 82.5954 191.411C83.0764 194.241 83.7163 198.887 84.0903 200.596C84.3043 201.503 85.3184 206.309 85.4254 206.843C85.7454 207.964 86.2793 209.727 87.4543 213.411C87.8813 214.746 88.7894 217.202 89.3233 218.217C90.3383 220.299 92.5273 224.464 93.2213 224.464C94.3423 224.464 95.3034 218.964 95.5173 216.828C95.6244 215.921 95.6774 214.746 95.5173 213.251C95.1433 209.887 94.3423 208.445 93.9153 206.309C93.6483 204.921 92.9544 203.586 92.9014 201.29C92.9014 200.008 93.1684 199.011 93.7023 198.3C94.2353 197.605 96.2653 197.712 97.0663 198.033C98.0803 198.46 98.8813 198.62 100.803 200.008C110.842 207.27 113.458 212.023 113.458 212.023C118.478 219.231 121.628 224.678 125.099 233.114C126.327 236.105 129.05 243.313 133.055 257.731C133.162 258.211 135.351 266.861 136.366 270.706C136.793 272.308 137.808 279.303 138.021 280.638C138.235 281.973 138.715 286.565 138.822 287.259C139.089 289.075 140.531 303.439 140.531 303.439C140.531 303.439 149.021 246.944 159.06 216.241C169.098 185.538 197.559 133.636 201.457 125.252C205.408 116.869 218.704 95.4574 223.51 87.7674C230.291 76.9814 238.888 65.4474 243.32 57.1714C249.835 45.0504 253.412 43.1814 253.946 35.9194C254.534 28.7104 255.602 16.9634 258.966 12.4784C262.33 8.04637 268.31 2.43937 274.878 0.997365C280.752 -0.283635 287.587 -0.711642 293.567 2.06536C299.548 4.84236 301.363 6.97837 303.979 10.1814C306.596 13.3854 306.97 17.3374 309.96 20.3274C312.95 23.3174 327.848 29.2444 338.26 34.1034L348.673 38.9094C348.673 38.9094 367.949 47.6134 374.464 52.5254C382.367 58.5064 395.556 70.5744 402.604 77.9964C409.706 85.4184 430.531 109.233 438.7 127.495C446.924 145.703 449.006 149.121 452.477 160.975C457.016 176.353 458.297 184.363 456.215 191.892C456.215 192.105 456.055 192.372 455.948 192.746C455.36 194.669 453.011 201.984 445.856 206.202C444.681 206.897 441.904 208.498 438.006 208.872C435.497 209.086 433.628 208.765 431.599 208.338C426.312 207.27 422.468 205.295 421.346 204.494C417.448 201.61 413.657 197.605 411.308 195.737C410.56 195.363 398.279 186.819 392.886 184.576C387.493 182.334 380.07 177.848 374.464 176.193C368.91 174.538 360.153 170.96 357.75 170.96C355.348 170.96 350.649 168.771 346.59 168.931C342.479 169.145 339.702 169.305 337.833 172.082C335.964 174.912 334.095 175.98 335.003 180.091C335.964 184.203 336.498 190.13 338.955 195.737C342.586 204.066 344.081 208.338 346.911 213.411C356.042 229.697 360.901 231.566 370.085 246.143C379.536 261.148 383.968 274.39 386.371 281.706C388.347 287.793 391.337 296.604 392.138 306.269L393.099 317.802C393.099 317.802 392.138 318.71 394.381 319.831L396.624 320.953L429.943 325.064L467.001 327.681L470.579 325.759L544 191.999C544 191.999 544.16 191.251 545.495 191.091C546.776 190.877 545.869 190.877 546.776 190.877C547.684 190.877 568.189 191.251 569.31 192.212C570.431 193.12 568.936 195.363 568.189 198.139H568.349Z"
/>
</svg>
),
project: {
link: "https://github.com/icssc",
},
chat: {
link: "https://discord.gg/GzF76D7UhY",
},
docsRepositoryBase: "https://github.com/icssc/docs/tree/main",
head: (
<>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
</>
),
useNextSeoProps() {
return {
titleTemplate: "%s – ICSSC Projects",
};
},
footer: {
text: (
<span>
© {new Date().getFullYear()}{" "}
<a href="https://icssc.club/" target="_blank" rel="noreferrer">
ICS Student Council and contributors
</a>
.
</span>
),
},
};

export default config;
);
}
10 changes: 7 additions & 3 deletions components/logos/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
export { default as AntAlmanac } from "./AntAlmanac";
export { default as PeterPortal } from "./PeterPortal";
export { default as Zotistics } from "./Zotistics";
import { default as AntAlmanac } from "./AntAlmanac";
import { default as PeterPortal } from "./PeterPortal";
import { default as Zotistics } from "./Zotistics";

const logos = { AntAlmanac, PeterPortal, Zotistics };

export default logos;
Loading

0 comments on commit c3f1225

Please sign in to comment.