-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add new pages overview and props on components
- Loading branch information
1 parent
43d5ba9
commit ad7f805
Showing
26 changed files
with
302 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
--- | ||
parent: components | ||
category: data-display | ||
--- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
--- | ||
parent: components | ||
category: feedback | ||
--- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
--- | ||
parent: components | ||
category: data-display | ||
--- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
--- | ||
category: utilities | ||
parent: hooks | ||
name: 'useCopy' | ||
--- | ||
|
||
import { useCopyText } from '@welcome-ui/utils.copy' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ const options = { | |
}), | ||
], | ||
banner: { | ||
js: useClient ? '"use client"' : '', | ||
js: '"use client"', | ||
}, | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Sidebar } from '@/build-app/components/Sidebar' | ||
import { DocumentationLayout } from '@/build-app/layouts/Documentation' | ||
import { getDocsPages } from '@/build-app/utils/pages-docs' | ||
import { Tabs } from './tabs' | ||
|
||
export default function Layout({ children }: { children: React.ReactNode }) { | ||
const pages = getDocsPages() | ||
|
||
return ( | ||
<DocumentationLayout> | ||
<Sidebar pages={pages} /> | ||
<div> | ||
<Tabs /> | ||
{children} | ||
</div> | ||
</DocumentationLayout> | ||
) | ||
} |
27 changes: 15 additions & 12 deletions
27
website/app/design/[category]/page.tsx → website/app/components/[category]/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,39 @@ | ||
import { Mdx } from '@/build-app/components/Mdx' | ||
import { Sidebar } from '@/build-app/components/Sidebar' | ||
import { TableOfContent } from '@/build-app/components/TableOfContent' | ||
import { DocumentationLayout } from '@/build-app/layouts/Documentation' | ||
import { getPageContent } from '@/build-app/utils/page-content' | ||
import { getDesignPages } from '@/build-app/utils/pages-design' | ||
import Link from 'next/link' | ||
import { getDocsPages, getStaticParams } from '@/build-app/utils/pages-docs' | ||
import { startCase } from 'lodash' | ||
import { notFound } from 'next/navigation' | ||
|
||
type PageProps = { | ||
params: { | ||
page: string | ||
category: string | ||
} | ||
} | ||
|
||
export async function generateStaticParams() { | ||
const pages = getDocsPages() | ||
|
||
return getStaticParams(pages) | ||
} | ||
|
||
export default function Page({ params }: PageProps) { | ||
const { category } = params | ||
|
||
const { isNotFound, tree, contentWithoutMatter } = getPageContent(`design/${category}.md`) | ||
const pages = getDesignPages() | ||
const { isNotFound, tree, contentWithoutMatter } = getPageContent( | ||
`${startCase(category)}/docs/index.mdx`, | ||
true | ||
) | ||
|
||
if (isNotFound) return notFound() | ||
|
||
return ( | ||
<DocumentationLayout> | ||
<div> | ||
<Link href={`/design`}>Go to main page</Link> | ||
<Sidebar pages={pages} relativePath="/design" /> | ||
</div> | ||
<> | ||
<main> | ||
<Mdx>{contentWithoutMatter}</Mdx> | ||
</main> | ||
<TableOfContent tree={tree} /> | ||
</DocumentationLayout> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Properties } from '@/build-app/components/Props' | ||
import { getComponentProperties } from '@/build-app/utils/components-properties' | ||
import { getDocsPages, getStaticParams } from '@/build-app/utils/pages-docs' | ||
|
||
type PageProps = { | ||
params: { | ||
category: string | ||
} | ||
} | ||
|
||
export async function generateStaticParams() { | ||
const pages = getDocsPages() | ||
|
||
return getStaticParams(pages) | ||
} | ||
|
||
export default function Page({ params }: PageProps) { | ||
console.log(params) | ||
const properties = getComponentProperties(params.category) | ||
|
||
return <Properties items={properties} /> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use client' | ||
|
||
import { Tab, useTab } from '@welcome-ui/tabs' | ||
import Link from 'next/link' | ||
import { useParams, usePathname } from 'next/navigation' | ||
|
||
export function Tabs() { | ||
const pathname = usePathname() | ||
const tab = useTab({ selectedId: pathname.split('/').pop() }) | ||
const { category } = useParams() | ||
|
||
return ( | ||
<Tab.List aria-label="Tabs" store={tab}> | ||
<Tab as={Link} href={`/components/${category}`} store={tab} id={category as string}> | ||
Overview | ||
</Tab> | ||
<Tab store={tab} as={Link} href={`/components/${category}/props`} id="props"> | ||
Props | ||
</Tab> | ||
</Tab.List> | ||
) | ||
} |
10 changes: 4 additions & 6 deletions
10
website/app/docs/page.tsx → website/app/components/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
import { Sidebar } from '@/build-app/components/Sidebar' | ||
import { getDocsPages } from '@/build-app/utils/pages-docs' | ||
import Link from 'next/link' | ||
|
||
export default function Page() { | ||
const pages = getDocsPages() | ||
|
||
return ( | ||
<div> | ||
<h1>Docs</h1> | ||
<Link href="/">Back Home</Link> | ||
<Sidebar pages={pages} relativePath="/docs" /> | ||
</div> | ||
<> | ||
<h1>Components</h1> | ||
<Sidebar pages={pages} /> | ||
</> | ||
) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Sidebar } from '@/build-app/components/Sidebar' | ||
import { getDocsPages } from '@/build-app/utils/pages-docs' | ||
|
||
export default function Page() { | ||
const pages = getDocsPages('hooks') | ||
|
||
return ( | ||
<> | ||
<h1>Hooks</h1> | ||
<Sidebar pages={pages} /> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,3 @@ | ||
import Link from 'next/link' | ||
|
||
export default function Home() { | ||
return ( | ||
<div style={{ display: 'grid', gap: 20 }}> | ||
<Link href="/design">Design</Link> | ||
<Link href="/docs">Docs</Link> | ||
</div> | ||
) | ||
return <h1>Home</h1> | ||
} |
Oops, something went wrong.