-
Notifications
You must be signed in to change notification settings - Fork 33
Refactor documentation structure and remove unused components #121
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
25aff8b
Refactor documentation structure and remove unused components
marklundin de955f8
Update packages/docs/app/[[...mdxPath]]/page.tsx
marklundin 9c09d5b
Update packages/docs/content/_meta.tsx
marklundin 5bfe65f
Update packages/docs/app/[[...mdxPath]]/page.tsx
marklundin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,63 @@ | ||
| import { generateStaticParamsFor, importPage } from 'nextra/pages' | ||
| import { useMDXComponents as getMDXComponents } from '../../mdx-components' | ||
| import { readFile } from 'node:fs/promises' | ||
| import path from 'node:path' | ||
| import Playground from '@docs-components/Playground' | ||
|
|
||
| export const generateStaticParams = generateStaticParamsFor('mdxPath') | ||
| const EXAMPLES_PATH = 'examples' | ||
|
|
||
| export async function generateMetadata(props) { | ||
| const params = await props.params | ||
|
|
||
| const isExamples = params.mdxPath[0] === EXAMPLES_PATH; | ||
|
|
||
| if (isExamples) { | ||
| const fileName = params.mdxPath.slice(-1)[0]; | ||
| const contentPath = params.mdxPath.slice(0, 1); | ||
|
|
||
| const source = await readFile( | ||
| path.join(process.cwd(), 'content', ...contentPath, `${fileName}.meta.json`), | ||
| 'utf-8' | ||
| ) | ||
|
|
||
| // We can't dynamically import with the full path. An error is thrown because the import is too dynamic. | ||
| // const metaPath = path.join('@content', 'examples', `${fileName}.meta.tsx`) | ||
| // const { default: metadata } = await import(metaPath); | ||
| return JSON.parse(source); | ||
| } | ||
|
|
||
| const { metadata } = await importPage(params.mdxPath) | ||
| return metadata | ||
| } | ||
|
|
||
| const Wrapper = getMDXComponents().wrapper | ||
|
|
||
| export default async function Page(props) { | ||
| const params = await props.params | ||
|
|
||
| const { default: MDXContent, toc, metadata } = await importPage(params.mdxPath) | ||
| const isExamples = params.mdxPath[0] === EXAMPLES_PATH; | ||
|
|
||
| if (isExamples) { | ||
| const contentPath = params.mdxPath.slice(0, 1); | ||
| const fileName = params.mdxPath.slice(-1)[0]; | ||
|
|
||
| const source = await readFile( | ||
| path.join(process.cwd(), 'content', ...contentPath, `${fileName}.mdx`), | ||
| 'utf-8' | ||
| ) | ||
|
|
||
| return ( | ||
| <div className='absolute top-0 left-0 w-screen h-screen pointer-events-none'> | ||
| <Playground name={`./${params.mdxPath}.tsx`} code={source} path={metadata.filePath}/> | ||
| </div> | ||
| ) | ||
| } | ||
|
|
||
| return ( | ||
| <Wrapper toc={toc} metadata={metadata}> | ||
| <MDXContent {...props} params={params} /> | ||
| </Wrapper> | ||
| ) | ||
| } |
File renamed without changes.
This file contains hidden or 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 hidden or 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or 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,65 @@ | ||
| import type { MetaRecord } from 'nextra' | ||
|
|
||
| // examples list | ||
| const examplesList = { | ||
| // "Basic" : { | ||
| // type: 'separator', | ||
| // }, | ||
| 'hello-world': { | ||
| title: 'Hello World', | ||
| href: '/examples/hello-world' | ||
| }, | ||
| 'load-a-3D-model' : { | ||
| title : 'Load a 3D model', | ||
| href: '/examples/load-a-3D-model' | ||
| }, | ||
| 'primitives' : { | ||
| title: 'Primitives', | ||
| href: '/examples/primitives' | ||
| }, | ||
| 'pointer-events' : { | ||
| href: '/examples/pointer-events' | ||
| }, | ||
| // "Advanced" : { | ||
| // type: 'separator', | ||
| // }, | ||
| 'model-viewer' : { | ||
| href: '/examples/model-viewer' | ||
| }, | ||
| 'splats' : { | ||
| title: "Splat Viewer", | ||
| href: '/examples/splats' | ||
| }, | ||
| 'physics' : { | ||
| href: '/examples/physics' | ||
| }, | ||
| 'motion' : { | ||
| href: '/examples/motion' | ||
| }, | ||
| } | ||
|
|
||
| const meta: MetaRecord = { | ||
| docs: { | ||
| title: 'Docs', | ||
| type: 'page', | ||
| theme: { | ||
| sidebar: true, | ||
| } | ||
| }, | ||
| examples: { | ||
| title: 'Examples', | ||
| type: 'menu', | ||
| items: examplesList | ||
| }, | ||
| '': { | ||
| type: 'separator', | ||
| }, | ||
| faq: {}, | ||
| github_link: { | ||
| title: 'PlayCanvas Docs', | ||
| href: 'https://developer.playcanvas.com' | ||
| }, | ||
| } | ||
|
|
||
|
|
||
| export default meta; | ||
This file contains hidden or 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,10 @@ | ||
|
|
||
| import type { MetaRecord } from 'nextra' | ||
|
|
||
| const meta: MetaRecord = { | ||
| installation: {}, | ||
| guide: {}, | ||
| api: {}, | ||
| } | ||
|
|
||
| export default meta |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...rc/app/docs/guide/loading-assets/page.mdx → ...ocs/content/docs/guide/loading-assets.mdx
This file contains hidden or 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 hidden or 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
File renamed without changes.
This file contains hidden or 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,11 @@ | ||
| import type { MetaRecord } from 'nextra' | ||
|
|
||
| const meta: MetaRecord = { | ||
| '*': { | ||
| theme: { | ||
| footer: false, | ||
| }, | ||
| }, | ||
| } | ||
|
|
||
| export default meta |
This file contains hidden or 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 hidden or 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,15 @@ | ||
| { | ||
| "title": "Hello World Example 🚀", | ||
| "description": "Learn how to create a simple 3D scene in @playcanvas/react", | ||
| "openGraph": { | ||
| "title": "Hello World Example 🚀", | ||
| "description": "Learn how to create a simple 3D scene in @playcanvas/react", | ||
| "images": [ | ||
| { | ||
| "url": "https://playcanvas-react.vercel.app/pc_react-og.png", | ||
| "width": 1200, | ||
| "height": 630 | ||
| } | ||
| ] | ||
| } | ||
| } |
File renamed without changes.
This file contains hidden or 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,15 @@ | ||
| { | ||
| "title": "Animation 🚀", | ||
| "description": "Learn how to play animations in 3D models.", | ||
| "openGraph": { | ||
| "title": "Animation Example 🚀", | ||
| "description": "Learn how to play animations in 3D models in @playcanvas/react", | ||
| "images": [ | ||
| { | ||
| "url": "https://playcanvas-react.vercel.app/pc_react-og.png", | ||
| "width": 1200, | ||
| "height": 630 | ||
| } | ||
| ] | ||
| } | ||
| } |
File renamed without changes.
This file contains hidden or 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,15 @@ | ||
| { | ||
| "title": "Model Viewer 🚀", | ||
| "description": "Learn how to load and render a simple 3D model.", | ||
| "openGraph": { | ||
| "title": "Model Viewer Example 🚀", | ||
| "description": "Learn how to load and render a simple 3D model in @playcanvas/react", | ||
| "images": [ | ||
| { | ||
| "url": "https://playcanvas-react.vercel.app/pc_react-og.png", | ||
| "width": 1200, | ||
| "height": 630 | ||
| } | ||
| ] | ||
| } | ||
| } |
File renamed without changes.
This file contains hidden or 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,15 @@ | ||
| { | ||
| "title": "Motion Example 💫", | ||
| "description": "Learn how to add motion to your 3D models using Framer Motion.", | ||
| "openGraph": { | ||
| "title": "Motion Example 💫", | ||
| "description": "Learn how to add motion to your 3D models using Framer Motion in @playcanvas/react", | ||
| "images": [ | ||
| { | ||
| "url": "https://playcanvas-react.vercel.app/pc_react-og.png", | ||
| "width": 1200, | ||
| "height": 630 | ||
| } | ||
| ] | ||
| } | ||
| } |
File renamed without changes.
This file contains hidden or 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,15 @@ | ||
| { | ||
| "title": "Physics Example ⚡", | ||
| "description": "Easily add declarative physics to your 3D models.", | ||
| "openGraph": { | ||
| "title": "Physics Example ⚡", | ||
| "description": "Easily add declarative physics to your 3D models in @playcanvas/react", | ||
| "images": [ | ||
| { | ||
| "url": "https://playcanvas-react.vercel.app/pc_react-og.png", | ||
| "width": 1200, | ||
| "height": 630 | ||
| } | ||
| ] | ||
| } | ||
| } |
File renamed without changes.
This file contains hidden or 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,15 @@ | ||
| { | ||
| "title": "Pointer Events Example 👆🏼", | ||
| "description": "Learn how to handle pointer events in your scene.", | ||
| "openGraph": { | ||
| "title": "Pointer Events Example 👆🏼", | ||
| "description": "Learn how to handle pointer events in your scene in @playcanvas/react", | ||
| "images": [ | ||
| { | ||
| "url": "https://playcanvas-react.vercel.app/pc_react-og.png", | ||
| "width": 1200, | ||
| "height": 630 | ||
| } | ||
| ] | ||
| } | ||
| } |
File renamed without changes.
This file contains hidden or 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,15 @@ | ||
| { | ||
| "title": "Primitives Example ⚪", | ||
| "description": "Learn how to add simple 3D primtive shapes to your scene.", | ||
| "openGraph": { | ||
| "title": "Primitives Example ⚪", | ||
| "description": "Learn how to add simple 3D primtive shapes to your scene in @playcanvas/react", | ||
| "images": [ | ||
| { | ||
| "url": "https://playcanvas-react.vercel.app/pc_react-og.png", | ||
| "width": 1200, | ||
| "height": 630 | ||
| } | ||
| ] | ||
| } | ||
| } |
File renamed without changes.
This file contains hidden or 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,15 @@ | ||
| { | ||
| "title": "Scripting Example 🎮", | ||
| "description": "Learn how to add custom scripts to your 3D models.", | ||
| "openGraph": { | ||
| "title": "Scripting Example 🎮", | ||
| "description": "Learn how to add custom scripts to your 3D models in @playcanvas/react", | ||
| "images": [ | ||
| { | ||
| "url": "https://playcanvas-react.vercel.app/pc_react-og.png", | ||
| "width": 1200, | ||
| "height": 630 | ||
| } | ||
| ] | ||
| } | ||
| } |
File renamed without changes.
This file contains hidden or 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,15 @@ | ||
| { | ||
| "title": "Gaussian Splats 💀", | ||
| "description": "Learn how to add Gaussian Splats to your scene.", | ||
| "openGraph": { | ||
| "title": "Gaussian Splats Example 💀", | ||
| "description": "Learn how to add Gaussian Splats to your scene in @playcanvas/react", | ||
| "images": [ | ||
| { | ||
| "url": "https://playcanvas-react.vercel.app/pc_react-og.png", | ||
| "width": 1200, | ||
| "height": 630 | ||
| } | ||
| ] | ||
| } | ||
| } |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
packages/docs/src/docs-components/Editor.tsx → packages/docs/docs-components/Editor.tsx
This file contains hidden or 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.