Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(docs): Refine Docs, Blog, API and Layout #93

Open
wants to merge 46 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
f09a68b
feat: Upgraded Fumadocs UI
Pyr33x Jan 2, 2025
68fa5c5
chore(docs): update hook api titles
Pyr33x Jan 2, 2025
403d8f8
fix(ui): add missing fumadocs-ui
Pyr33x Jan 2, 2025
8062722
chore(docs): Legal Documents
Pyr33x Jan 2, 2025
6722c4d
feat(docs): legal stuff in footer
Pyr33x Jan 2, 2025
9008204
fix(docs): import links instead of declaring
Pyr33x Jan 2, 2025
633d404
fix(docs): hover effects of icons in footer
Pyr33x Jan 2, 2025
7614a39
ref(core): update descriptions
Pyr33x Jan 2, 2025
c185d52
fix(docs): convert hooks
Pyr33x Jan 2, 2025
bd15b7c
chore(docs): updated descriptions
Pyr33x Jan 2, 2025
027eb8e
ref(docs): useCounter
Pyr33x Jan 2, 2025
c5ccd89
chore(docs): update introduction
Pyr33x Jan 2, 2025
cdef23b
chore(docs): rewrite some stuff
Pyr33x Jan 2, 2025
f610504
feat(docs): sidebar options & group docs
Pyr33x Jan 3, 2025
893e02f
feat(docs): api group stuff
Pyr33x Jan 3, 2025
8ec1da5
feat(docs): setup openapi
Pyr33x Jan 3, 2025
b1e27c0
feat: openapi schema
Pyr33x Jan 3, 2025
670f745
feat: Open API Docs
Pyr33x Jan 3, 2025
be7432f
fix(docs): improve some landing items
Pyr33x Jan 3, 2025
a800b67
fix(docs): change card hrefs & editor improvements
Pyr33x Jan 3, 2025
b2e2135
chore(docs): update icons
Pyr33x Jan 4, 2025
3f8e36f
feat(docs): change pallett
Pyr33x Jan 5, 2025
81448f8
feat(docs): recolor editor
Pyr33x Jan 5, 2025
8fd1be1
fix(docs): prevent unnecessary re-renders
Pyr33x Jan 5, 2025
c6a1e0c
fix(docs): quick fix rehooks icon
Pyr33x Jan 5, 2025
ffcc4dd
feat(docs): separate api and cli
Pyr33x Jan 5, 2025
b457514
fix(docs): navigation
Pyr33x Jan 5, 2025
1624e56
fix(docs): fix colors on light mode
Pyr33x Jan 5, 2025
2c0ca81
fix(docs): navigation & icon
Pyr33x Jan 6, 2025
83be349
refactor(docs): remove cobe
Pyr33x Jan 6, 2025
332f9b2
feat(docs): setup blog
Pyr33x Jan 6, 2025
49f332a
refactor(docs): wrap up blog
Pyr33x Jan 7, 2025
3b80825
feat(docS): commit cards
Pyr33x Jan 9, 2025
a2bce66
chore(docs): update hero description
Pyr33x Jan 9, 2025
c32afc2
feat(docs): shimmer
Pyr33x Jan 9, 2025
e26bc9d
refactor: update descriptions
Pyr33x Jan 9, 2025
1968a04
feat(docs): resources
Pyr33x Jan 9, 2025
2293bf3
chore(docs): add resources icon
Pyr33x Jan 9, 2025
a9cdd99
fix(docs): legal routes
Pyr33x Jan 9, 2025
d264d80
feat: update favicons and og
Pyr33x Jan 9, 2025
51465ed
fix(docs): urls
Pyr33x Jan 10, 2025
ac3355c
refactor(docs): some lil improvements
Pyr33x Jan 12, 2025
c54588b
feat(docs): add CLI installation for each hook
Pyr33x Jan 23, 2025
ae8b72f
fix(docs): home container margin
Pyr33x Jan 23, 2025
ded7947
fix(docs): re-version
Pyr33x Jan 23, 2025
a6491ea
feat(docs): aurora
Pyr33x Jan 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<div align="center">
<h1>Rehooks CLI</h1>
<p>A CLI to insert hooks directly to your project.</p>
<p>A CLI to scaffold your react custom hooks, with a focus on performance, reusability, and type-safety.</p>
</div>

<div align="center">
Expand Down
17 changes: 17 additions & 0 deletions apps/docs/app/(home)/(blog)/blog/(root)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { HomeLayout } from "fumadocs-ui/layouts/home";
import Footer from "@/app/(home)/_components/footer";
import { baseOptions } from "@/app/layout.config";
import type { ReactNode } from "react";

export default function BlogLayout({
children,
}: Readonly<{
children: ReactNode;
}>): React.ReactElement {
return (
<HomeLayout {...baseOptions}>
{children}
<Footer className="absolute bottom-0 left-0 right-0" />
</HomeLayout>
);
}
33 changes: 33 additions & 0 deletions apps/docs/app/(home)/(blog)/blog/(root)/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { RehooksIcon } from "@rehooks/ui/icons";
import { blog } from "@/lib/docs/source";
import Link from "next/link";

export default function BlogPage() {
const posts = blog.getPages();

return (
<main className="container mx-auto grow px-4 py-8">
<div className="flex flex-row items-center gap-x-2">
<RehooksIcon className="size-10" stroke="#8b5cf6" />
<h1 className="text-4xl font-bold">Rehooks Blog</h1>
</div>
<hr className="border-t-fd-border my-6 border-t" />
<div className="grid gap-6 md:grid-cols-2 lg:grid-cols-3">
{posts.map((post) => (
<Link
key={post.url}
href={post.url}
className="bg-fd-background border-fd-border hover:bg-fd-secondary/50 block overflow-hidden rounded-lg border p-6"
>
<h2 className="text-fd-foreground mb-2 text-xl font-semibold">
{post.data.title}
</h2>
<p className="text-fd-muted-foreground mb-4">
{post.data.description}
</p>
</Link>
))}
</div>
</main>
);
}
11 changes: 11 additions & 0 deletions apps/docs/app/(home)/(blog)/blog/[slug]/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { HomeLayout } from "fumadocs-ui/layouts/home";
import { baseOptions } from "@/app/layout.config";
import type { ReactNode } from "react";

export default function SlugLayout({
children,
}: Readonly<{
children: ReactNode;
}>): React.ReactElement {
return <HomeLayout {...baseOptions}>{children}</HomeLayout>;
}
75 changes: 75 additions & 0 deletions apps/docs/app/(home)/(blog)/blog/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import defaultMdxComponents from "fumadocs-ui/mdx";
import { CornerDownLeft } from "@rehooks/ui/icons";
import { notFound } from "next/navigation";
import { blog } from "@/lib/docs/source";
import Link from "next/link";

export default async function BlogPost(props: {
params: Promise<{ slug: string }>;
}) {
const params = await props.params;
const page = blog.getPage([params.slug]);

if (!page) notFound();
const Mdx = page.data.body;

return (
<>
<div className="bg-fd-background container mt-8 rounded-xl border p-8">
<h1 className="mg:text-3xl mb-2 text-xl font-bold">
{page.data.title}
</h1>
<p className="text-fd-muted-foreground mb-4 text-base md:text-lg">
{page.data.description}
</p>
<div className="flex items-center">
<Link
href="/blog"
className="bg-fd-background border-fd-border hover:bg-fd-secondary inline-flex transform items-center gap-x-2 rounded-md border px-4 py-1 transition"
>
Back
<CornerDownLeft className="inline-block size-4" />
</Link>
</div>
</div>
<article className="container flex flex-col px-4 py-8">
<div className="prose min-w-0">
<Mdx components={defaultMdxComponents} />
</div>
<hr className="border-t-fd-border my-12 border-t" />
<div className="flex flex-col gap-4 text-sm">
<div>
<p className="text-fd-muted-foreground mb-1">Written by</p>
<p className="font-medium">{page.data.author}</p>
</div>
<div>
<p className="text-fd-muted-foreground mb-1 text-sm">At</p>
<p className="font-medium">
{new Date(page.data.date).toDateString()}
</p>
</div>
</div>
</article>
</>
);
}

export function generateStaticParams(): { slug: string }[] {
return blog.getPages().map((page) => ({
slug: page.slugs[0],
}));
}

export async function generateMetadata(props: {
params: Promise<{ slug: string }>;
}) {
const params = await props.params;
const page = blog.getPage([params.slug]);

if (!page) notFound();

return {
title: page.data.title,
description: page.data.description,
};
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { HomeLayout } from "fumadocs-ui/layouts/home";
import Footer from "@/app/(home)/_components/footer";
import { HomeLayout } from "fumadocs-ui/home-layout";
import { baseOptions } from "@/app/layout.config";
import { Grid } from "@rehooks/ui/components";
import type { ReactNode } from "react";
Expand All @@ -17,7 +17,7 @@ export default function Layout({
height={46}
x={-1}
y={-1}
strokeDasharray={"4 2"}
strokeDasharray={"2 4"}
className="-z-50 [mask-image:radial-gradient(350px_circle_at_center,white,#ffffff50)] dark:[mask-image:radial-gradient(350px_circle_at_center,white,#ffffff01)]"
/>
<Footer />
Expand Down
53 changes: 53 additions & 0 deletions apps/docs/app/(home)/(home)/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { Editor } from "@/app/(home)/_components/editor";
import { Grid } from "@/app/(home)/_components/bento";
import { Hero } from "@/app/(home)/_components/hero";
import { ArrowUpRight } from "@rehooks/ui/icons";
import { ReactNode } from "react";

export default function HomePage() {
return (
<div className="mx-8 my-12 flex min-h-screen flex-col items-center justify-center">
<div className="mb-6">
<Badge
icon={
<ArrowUpRight className="size-3 transition-transform duration-100 group-hover:-translate-y-px group-hover:translate-x-px" />
}
>
Rehooks v4.5 Released!
</Badge>
</div>
<Hero />
<Editor />
<h2 className="text-fd-muted-foreground select-none text-xl font-medium uppercase">
Features
</h2>
<h3 className="text-fd-foreground my-1 text-wrap text-center text-3xl font-semibold">
Crafted for Efficiency
</h3>
<h4 className="text-fd-muted-foreground mt-1.5 max-w-lg text-pretty text-center text-xl italic">
I've created Rehooks to streamline the process of creating custom hooks,
and get rid of heavy packages.
</h4>
<div className="mt-10 max-w-6xl">
<Grid />
</div>
</div>
);
}

function Badge({ children, icon }: { children: ReactNode; icon?: ReactNode }) {
return (
<a
href="#"
className="divide-fd-border border-fd-border bg-fd-background hover:bg-fd-secondary/50 group flex items-center rounded-full border text-xs font-medium drop-shadow-sm backdrop-blur-sm transition-colors duration-75 sm:divide-x"
>
<span className="text-fd-foreground py-1.5 pl-4 text-sm sm:pr-2.5">
{children}
</span>
<div className="text-fd-muted-foreground flex items-center gap-1.5 p-1.5 pl-2.5">
<span className="hidden text-sm sm:block">Read more</span>
<div className="rounded-full bg-blue-600 p-1 text-white">{icon}</div>
</div>
</a>
);
}
4 changes: 2 additions & 2 deletions apps/docs/app/(home)/_components/bento.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { features } from "@/app/(home)/_components/cards";
export function Grid() {
return (
<BentoGrid>
{features.map((feature, idx) => (
<BentoCard key={idx} {...feature} />
{features.map((features, index) => (
<BentoCard key={index} {...features} />
))}
</BentoGrid>
);
Expand Down
118 changes: 67 additions & 51 deletions apps/docs/app/(home)/_components/cards.tsx
Original file line number Diff line number Diff line change
@@ -1,67 +1,79 @@
"use client";

import { Globe as GlobeIcon, Braces, Layers, Zap } from "@rehooks/ui/icons";
import { Retro, Marquee, Text } from "@rehooks/ui/components";
import {
Globe,
Braces,
Layers,
Zap,
Wrench,
Sparkles,
Hammer,
} from "@rehooks/ui/icons";
import { Retro, Marquee, Text, Shimmer } from "@rehooks/ui/components";
import { cn, hooks } from "@rehooks/utils";
import { useEffect, useRef } from "react";
import createGlobe from "cobe";

export const Globe = ({ className }: { className?: string }) => {
const canvasRef = useRef<HTMLCanvasElement>(null);

useEffect(() => {
let phi = 0;

if (!canvasRef.current) return;

const globe = createGlobe(canvasRef.current, {
devicePixelRatio: 2,
width: 600 * 2,
height: 600 * 2,
phi: 0,
theta: 0,
dark: 1,
diffuse: 1.2,
mapSamples: 16000,
mapBrightness: 6,
baseColor: [0.3, 0.3, 0.3],
markerColor: [0.545, 0.361, 0.965],
glowColor: [0.1, 0.1, 0.1],
markers: [
{ location: [37.7595, -122.4367], size: 0.04 },
{ location: [40.7128, -74.006], size: 0.04 },
{ location: [52.7128, -242.831], size: 0.04 },
],
onRender: (state) => {
state.phi = phi;
phi += 0.01;
},
});

return () => {
globe.destroy();
};
}, []);
import type { ReactNode } from "react";

function CommitCard({
className,
comment,
icon,
}: {
className?: string;
comment: string;
icon: ReactNode;
}) {
return (
<canvas
ref={canvasRef}
style={{ width: 600, height: 600, maxWidth: "100%", aspectRatio: 1 }}
className={cn("pointer-events-none transform-gpu", className)}
/>
<div
className={cn(
"dark:bg-fd-muted/25 bg-fd-muted border-fd-border/50 absolute inline-flex h-10 w-80 transform select-none items-center rounded-full border px-3 transition-all group-hover:-right-4 lg:w-72",
className,
)}
>
<span>{icon}</span>
<Shimmer color="#888" className="font-mono text-xs" text={comment} />
</div>
);
};
}

const commits = [
{
comment: "fix(cli): no args passed",
icon: <Wrench className="text-fd-foreground/50 mr-2 size-4" />,
className: "-right-4",
},
{
comment: "feat(core): health checker",
icon: (
<Sparkles className="text-fd-foreground/50 mr-2 size-4 transform transition group-hover:rotate-180" />
),
className: "-right-12 top-12",
},
{
comment: "ref(docs): add missing props",
icon: <Hammer className="text-fd-foreground/50 mr-2 size-4" />,
className: "-right-24 top-24",
},
];

export const features = [
{
Icon: GlobeIcon,
Icon: Globe,
name: "Open-Source Codebase",
description:
"Rehooks is an open-source project, to expand OSS communities.",
"Rehooks is an open-source project, licensed under Apache 2.0.",
className:
"lg:row-start-1 lg:row-end-1 lg:col-start-1 lg:col-end-2 rounded-t-2xl lg:rounded-tl-2xl lg:rounded-tr-none border-b-[0.5px] border-r-[1px] lg:border-r-[0.5px] border-t-[1px] border-l-[1px]",
background: (
<Globe className="absolute -bottom-80 -right-10 [mask-image:linear-gradient(to_top,transparent_60%,#000_100%)] md:-bottom-72 md:-right-10" />
<div className="absolute right-0 top-9">
{commits.map((commit, index) => (
<CommitCard
className={commit.className}
key={index}
icon={commit.icon}
comment={commit.comment}
/>
))}
</div>
),
},
{
Expand All @@ -71,7 +83,11 @@ export const features = [
"Rehooks is written in TypeScript, ensuring type safety and maintainability throughout the codebase.",
className:
"lg:col-start-3 lg:col-end-3 lg:row-start-2 lg:row-end-2 lg:rounded-br-2xl lg:rounded-tr-none border-b-[0.5px] lg:border-b-[1px] border-r-[1px] border-t-[0.5px] border-l-[1px] lg:border-l-[0.5px]",
background: <Text text="<T>" className="absolute -top-16" />,
background: (
<div className="flex h-full w-full items-center justify-center">
<Text text="<T>" className="absolute top-16" />
</div>
),
},
{
Icon: Layers,
Expand Down
Loading
Loading