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

chore: update all packages deps and upgrade docs to latest fumadocs version #80

Merged
merged 5 commits into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions .changeset/long-cooks-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"docs": patch
"@stepperize/react": patch
"@stepperize/solid": patch
"@stepperize/svelte": patch
"@stepperize/vue": patch
---

chore: update all packages deps and upgrade docs to latest fumadocs version
50 changes: 25 additions & 25 deletions apps/docs/.source/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion apps/docs/.source/source.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ var source_config_default = defineConfig({
light: "catppuccin-latte",
dark: "catppuccin-mocha"
},
//@ts-ignore
transformers: [...rehypeCodeDefaultOptions.transformers ?? [], transformerTwoslash()]
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/app/(home)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HomeLayout } from "fumadocs-ui/home-layout";
import { HomeLayout } from "fumadocs-ui/layouts/home";
import type { ReactNode } from "react";
import { baseOptions } from "../layout.config";

Expand Down
18 changes: 7 additions & 11 deletions apps/docs/app/docs/[[...slug]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@ import { useMDXComponents } from "@/mdx-components";
import { createMetadata, metadataImage } from "@/utils/metadata";
import defaultMdxComponents from "fumadocs-ui/mdx";
import { DocsBody, DocsDescription, DocsPage, DocsTitle } from "fumadocs-ui/page";
import type { Metadata } from "next";
import { notFound } from "next/navigation";

interface Param {
slug: string[];
}

export default async function Page({
params,
}: {
params: Param;
export default async function Page(props: {
params: Promise<{ slug?: string[] }>;
}) {
const params = await props.params;
const page = source.getPage(params.slug);
if (!page) {
notFound();
Expand Down Expand Up @@ -55,9 +49,11 @@ export async function generateStaticParams() {
return source.generateParams();
}

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

if (!page) {
notFound();
}
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/app/docs/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DocsLayout } from "fumadocs-ui/layout";
import { DocsLayout } from "fumadocs-ui/layouts/docs";
import type { ReactNode } from "react";
import { docsOptions } from "../layout.config";

Expand Down
26 changes: 0 additions & 26 deletions apps/docs/app/layout.client.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
"use client";

import { modes } from "@/lib/modes";
import { cn } from "@/lib/utils";
import { cva } from "class-variance-authority";
import Link from "next/link";
import { useParams } from "next/navigation";
import type { ReactNode } from "react";

const itemVariants = cva("rounded-md px-2 py-1 transition-colors hover:text-fd-accent-foreground", {
variants: {
active: {
true: "bg-fd-accent text-fd-accent-foreground",
},
},
});

export function Body({
children,
}: {
Expand All @@ -25,20 +13,6 @@ export function Body({
return <body className={cn(mode, "relative flex min-h-screen flex-col")}>{children}</body>;
}

export function NavChildren(): React.ReactElement {
const mode = useMode();

return (
<div className="rounded-md border bg-fd-muted/80 p-1 text-sm text-fd-muted-foreground max-md:absolute max-md:left-1/2 max-md:-translate-x-1/2">
{modes.map((m) => (
<Link key={m.param} href={`/docs/${m.param}`} className={itemVariants({ active: mode === m.param })}>
{m.name}
</Link>
))}
</div>
);
}

export function useMode(): string | undefined {
const { slug } = useParams();
return Array.isArray(slug) && slug.length > 0 ? slug[0] : undefined;
Expand Down
51 changes: 38 additions & 13 deletions apps/docs/app/layout.config.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,43 @@
import type { HomeLayoutProps } from "fumadocs-ui/home-layout";
import type { DocsLayoutProps } from "fumadocs-ui/layout";

import { NavChildren } from "@/app/layout.client";
import { source } from "@/app/source";
import { modes } from "@/lib/modes";
import { RootToggle } from "fumadocs-ui/components/layout/root-toggle";
import type { DocsLayoutProps, LinkItemType } from "fumadocs-ui/layouts/docs";
import type { HomeLayoutProps } from "fumadocs-ui/layouts/home";
import { Waypoints } from "lucide-react";

import { icons } from "@/components/icons";

export const linkItems: LinkItemType[] = [
{
icon: <icons.ReactIcon />,
text: "React",
url: "/docs/react",
active: "nested-url",
description: "Stepperize for React",
},
{
icon: <icons.VueIcon />,
text: "Vue",
url: "/docs/vue",
active: "nested-url",
description: "Stepperize for Vue",
},
{
icon: <icons.SolidIcon />,
text: "Solid",
url: "/docs/solid",
active: "nested-url",
description: "Stepperize for Solid",
},
{
icon: <icons.SvelteIcon />,
text: "Svelte",
url: "/docs/svelte",
active: "nested-url",
description: "Stepperize for Svelte",
},
];

export const baseOptions: HomeLayoutProps = {
githubUrl: "https://github.com/damianricobelli/stepperize",
nav: {
Expand All @@ -17,16 +48,8 @@ export const baseOptions: HomeLayoutProps = {
</div>
),
transparentMode: "top",
children: <NavChildren />,
},
// links: [
// {
// icon: <BookIcon />,
// text: "Blog",
// url: "/blog",
// active: "nested-url",
// },
// ],
links: [...linkItems],
};

export const docsOptions: DocsLayoutProps = {
Expand All @@ -37,8 +60,10 @@ export const docsOptions: DocsLayoutProps = {
transparentMode: "none",
},
sidebar: {
tabs: false,
banner: (
<RootToggle
className="flex flex-row items-center gap-2 rounded-lg px-2 py-1.5 hover:bg-fd-accent/50 hover:text-fd-accent-foreground -mx-2"
options={modes.map((mode) => ({
url: `/docs/${mode.param}`,
icon: <mode.icon className="size-9 shrink-0 rounded-md p-1.5" />,
Expand Down
Loading