Skip to content

Commit

Permalink
refactor codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
fuma-nama committed Dec 18, 2024
1 parent 5954909 commit affc9fc
Show file tree
Hide file tree
Showing 62 changed files with 505 additions and 535 deletions.
2 changes: 1 addition & 1 deletion apps/docs/app/(home)/blog/[slug]/page.client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
TooltipTrigger,
} from '@radix-ui/react-tooltip';
import { useState } from 'react';
import { cn } from '@/utils/cn';
import { cn } from '@/lib/cn';
import { buttonVariants } from '@/components/ui/button';

export function Control({ url }: { url: string }): React.ReactElement {
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/app/(home)/blog/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { notFound } from 'next/navigation';
import Link from 'next/link';
import { InlineTOC } from 'fumadocs-ui/components/inline-toc';
import defaultMdxComponents from 'fumadocs-ui/mdx';
import { blog } from '@/app/source';
import { createMetadata } from '@/utils/metadata';
import { blog } from '@/lib/source';
import { createMetadata } from '@/lib/metadata';
import { buttonVariants } from '@/components/ui/button';
import { Control } from '@/app/(home)/blog/[slug]/page.client';

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/app/(home)/blog/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Link from 'next/link';
import { blog } from '@/app/source';
import { blog } from '@/lib/source';

export default function Page(): React.ReactElement {
const posts = [...blog.getPages()].sort(
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/app/(home)/docs/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Building2, LibraryIcon } from 'lucide-react';
import Link, { type LinkProps } from 'next/link';
import Image from 'next/image';
import { buttonVariants } from '@/components/ui/button';
import { cn } from '@/utils/cn';
import { cn } from '@/lib/cn';
import Spot from '@/public/spot.png';

export default function DocsPage(): React.ReactElement {
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/app/(home)/page.client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { TerminalIcon } from 'lucide-react';
import Link from 'next/link';
import scrollIntoView from 'scroll-into-view-if-needed';
import { cn } from '@/utils/cn';
import { cn } from '@/lib/cn';
import { buttonVariants } from '@/components/ui/button';

export function CreateAppAnimation() {
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/app/(home)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { File, Files, Folder } from 'fumadocs-ui/components/files';
import Link from 'next/link';
import type { HTMLAttributes, ReactNode } from 'react';
import Image from 'next/image';
import { cn } from '@/utils/cn';
import { cn } from '@/lib/cn';
import { buttonVariants } from '@/components/ui/button';
import { CodeBlock } from '@/components/code-block';
import { UwuHero } from '@/app/(home)/uwu';
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/app/(home)/showcase/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { PlusIcon } from 'lucide-react';
import Image, { type StaticImageData } from 'next/image';
import { cn } from '@/utils/cn';
import { cn } from '@/lib/cn';
import { buttonVariants } from '@/components/ui/button';
import { createMetadata } from '@/utils/metadata';
import { createMetadata } from '@/lib/metadata';
import NextFAQ from '@/public/showcases/next-faq.png';
import Yeecord from '@/public/showcases/yeecord.png';
import Nuqs from '@/public/showcases/nuqs.jpg';
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/app/(home)/sponsors/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
sponsorTiers,
} from '@/app/(home)/sponsors/data';
import { buttonVariants } from '@/components/ui/button';
import { cn } from '@/utils/cn';
import { getSponsors } from '@/utils/get-sponsors';
import { cn } from '@/lib/cn';
import { getSponsors } from '@/lib/get-sponsors';

export default async function Page() {
const sponsors = await getSponsors('fuma-nama', [
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/app/(home)/uwu.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Link from 'next/link';
import Image from 'next/image';
import { cn } from '@/utils/cn';
import { cn } from '@/lib/cn';
import { buttonVariants } from '@/components/ui/button';
import Logo from '@/public/logo.png';

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/app/api/proxy/route.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { openapi } from '@/app/source';
import { openapi } from '@/lib/source';

export const { GET, HEAD, PUT, POST, PATCH, DELETE } = openapi.createProxy();
6 changes: 3 additions & 3 deletions apps/docs/app/docs/[...slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { Callout } from 'fumadocs-ui/components/callout';
import { TypeTable } from 'fumadocs-ui/components/type-table';
import { Accordion, Accordions } from 'fumadocs-ui/components/accordion';
import * as Preview from '@/components/preview';
import { createMetadata } from '@/utils/metadata';
import { openapi, source } from '@/app/source';
import { createMetadata } from '@/lib/metadata';
import { openapi, source } from '@/lib/source';
import { Wrapper } from '@/components/preview/wrapper';
import { AutoTypeTable } from '@/components/type-table';
import { metadataImage } from '@/utils/metadata-image';
import { metadataImage } from '@/lib/metadata-image';

function PreviewRenderer({ preview }: { preview: string }): ReactNode {
if (preview && preview in Preview) {
Expand Down
11 changes: 5 additions & 6 deletions apps/docs/app/docs/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { DocsLayout, type DocsLayoutProps } from 'fumadocs-ui/layouts/docs';
import type { ReactNode } from 'react';
import { MessageCircle } from 'lucide-react';
import { Slot } from '@radix-ui/react-slot';
import { baseOptions, linkItems } from '@/app/layout.config';
import 'fumadocs-twoslash/twoslash.css';
import { source } from '@/app/source';
import { source } from '@/lib/source';
import { Trigger } from '@/components/ai/search-ai';
import { cn } from '@/utils/cn';
import { cn } from '@/lib/cn';
import { buttonVariants } from '@/components/ui/button';

const docsOptions: DocsLayoutProps = {
Expand All @@ -22,15 +21,15 @@ const docsOptions: DocsLayoutProps = {
return {
...option,
icon: (
<Slot
className="bg-gradient-to-t from-fd-background/80 p-1 [&_svg]:size-5"
<div
className="rounded-md border bg-gradient-to-t from-fd-background/80 p-1 shadow-md [&_svg]:size-5"
style={{
color: `hsl(var(--${meta.file.dirname}-color))`,
backgroundColor: `hsl(var(--${meta.file.dirname}-color)/.3)`,
}}
>
{node.icon}
</Slot>
</div>
),
};
},
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/app/layout.client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { useParams } from 'next/navigation';
import { type ReactNode, useId } from 'react';
import { cn } from '@/utils/cn';
import { cn } from '@/lib/cn';

export function Body({
children,
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import './global.css';
import type { Viewport } from 'next';
import { GeistSans } from 'geist/font/sans';
import { GeistMono } from 'geist/font/mono';
import { baseUrl, createMetadata } from '@/utils/metadata';
import { baseUrl, createMetadata } from '@/lib/metadata';
import { Body } from '@/app/layout.client';
import { Provider } from './provider';

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/app/og/[...slug]/route.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { readFileSync } from 'node:fs';
import { type ImageResponse } from 'next/og';
import { metadataImage } from '@/utils/metadata-image';
import { metadataImage } from '@/lib/metadata-image';
import { generateOGImage } from '@/app/og/[...slug]/og';

const font = readFileSync('./app/og/[...slug]/Geist-Regular.ttf');
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/app/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { MetadataRoute } from 'next';
import { baseUrl } from '@/utils/metadata';
import { source } from '@/app/source';
import { baseUrl } from '@/lib/metadata';
import { source } from '@/lib/source';

export const revalidate = false;

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/app/static.json/route.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { NextResponse } from 'next/server';
import { source } from '@/app/source';
import { source } from '@/lib/source';
import type { OramaDocument } from 'fumadocs-core/search/orama-cloud';

export const revalidate = false;
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/components/ai/search-ai.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from '@radix-ui/react-dialog';
import { Loader2, RefreshCw, Send, X } from 'lucide-react';
import defaultMdxComponents from 'fumadocs-ui/mdx';
import { cn } from '@/utils/cn';
import { cn } from '@/lib/cn';
import { buttonVariants } from '../../../../packages/ui/src/components/ui/button';
import type { Processor } from './markdown-processor';
import Link from 'fumadocs-core/link';
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/components/contributor-count.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { HTMLAttributes } from 'react';
import Image from 'next/image';
import { cn } from '@/utils/cn';
import { fetchContributors } from '@/utils/get-contributors';
import { cn } from '@/lib/cn';
import { fetchContributors } from '@/lib/get-contributors';

export interface ContributorCounterProps
extends HTMLAttributes<HTMLDivElement> {
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/components/preview/dynamic-codeblock.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';
import { DynamicCodeBlock } from 'fumadocs-ui/components/dynamic-codeblock';
import { useState } from 'react';
import { cn } from '@/utils/cn';
import { cn } from '@/lib/cn';
import { buttonVariants } from '@/components/ui/button';

export default function Example() {
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/components/preview/wrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { HTMLAttributes } from 'react';
import { cn } from '@/utils/cn';
import { cn } from '@/lib/cn';

export function Wrapper(
props: HTMLAttributes<HTMLDivElement>,
Expand Down
42 changes: 0 additions & 42 deletions apps/docs/components/ui/api-indicator.tsx

This file was deleted.

23 changes: 0 additions & 23 deletions apps/docs/components/ui/icon.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion apps/docs/content/blog/v14.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ Fumadocs v14 is compatible with Next.js 15, supporting sync and async usages of

The navigation menu on Home layout is redesigned, with better animation and flexibility.

See the [new API](/docs/ui/blocks/links).
See the [new API](/docs/ui/layouts/links).

![New Navbar](./v14-navbar.png)

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/headless/page-conventions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ For example, when you are in a root folder called `core`, the other folders (e.g
When a root folder exists, Fumadocs UI will add a Tabs component to the sidebar.
It allows user to switch between different roots.

You can customise it via [`sidebar.tabs`](/docs/ui/blocks/layout#sidebar-tabs) in Docs Layout.
You can customise it via [`sidebar.tabs`](/docs/ui/layouts/docs#sidebar-tabs) in Docs Layout.

</Callout>

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/ui/components/tabs.client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { useEffect, useState } from 'react';
import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
import { cn } from '@/utils/cn';
import { cn } from '@/lib/cn';
import { buttonVariants } from '@/components/ui/button';

export function UrlBar() {
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/ui/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Components are pre-built elements to enhance your documentation,
they are customisable with exposed props like `style` and `className`.

Layouts are essential elements of docs, providing navigation and basic functionality.
We provided many options to customise them, see [Layouts](/docs/ui/blocks).
We provided many options to customise them, see [Layouts](/docs/ui/layouts).

Fumadocs CLI offers a way to install Fumadocs components to your project, allowing you to fully customise them with code.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Docs Layout
description: The layout of documentation
---

The layout of documentation pages, it includes a sidebar and [navbar](/docs/ui/blocks/navbar).
The layout of documentation pages, it includes a sidebar and [navbar](/docs/ui/layouts/navbar).

> It is a server component, you should not reference it in a client component.
Expand Down Expand Up @@ -116,7 +116,7 @@ It is an anti-pattern to change your layout from a page.
You can consider:

1. Disable sidebar from the entire layout.
2. Create a [MDX Page](/docs/ui/blocks/page#mdx-page) in a layout that doesn't contain a sidebar.
2. Create a [MDX Page](/docs/ui/layouts/page#mdx-page) in a layout that doesn't contain a sidebar.

## Notebook

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { File, Files, Folder } from 'fumadocs-ui/components/files';

## Usage

Add a [navbar](/docs/ui/blocks/navbar) and search dialog across other pages.
Add a [navbar](/docs/ui/layouts/navbar) and search dialog across other pages.

It doesn't contain a sidebar, a page tree is not required.

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions apps/docs/content/docs/ui/manual-installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Make sure to create a `source.ts` file for content adapters, this allows Fumadoc

### Root Layout

Wrap the entire application inside [Root Provider](/docs/ui/blocks/root-provider), and add required styles to `body`.
Wrap the entire application inside [Root Provider](/docs/ui/layouts/root-provider), and add required styles to `body`.

```tsx
import { RootProvider } from 'fumadocs-ui/provider';
Expand Down Expand Up @@ -106,7 +106,7 @@ Create a folder `/app/docs` for our docs, and give it a proper layout.

Create a catch-all route `/app/docs/[[...slug]]` for docs pages.

In the page, wrap your content in the [Page](/docs/ui/blocks/page) component.
In the page, wrap your content in the [Page](/docs/ui/layouts/page) component.
It may vary depending on your content source. You should configure static rendering with `generateStaticParams` and metadata with `generateMetadata`.

<Tabs groupId='content-source' items={['Fumadocs MDX', 'Content Collections']}>
Expand Down Expand Up @@ -183,7 +183,7 @@ See [Organizing Pages](/docs/ui/page-conventions) for customising routing.

#### Other Pages

You can use [Home Layout](/docs/ui/blocks/home-layout) for other pages of the site.
You can use [Home Layout](/docs/ui/layouts/home-layout) for other pages of the site.
It includes the theme toggle and global navigation links.

### Deploying
Expand Down
Loading

0 comments on commit affc9fc

Please sign in to comment.