Remove examples app landing page (#2678)
This PR removes the examples app landing page, the home route now shows the basic example. ### Change Type - [ ] `patch` — Bug fix - [ ] `minor` — New feature - [ ] `major` — Breaking change - [ ] `dependencies` — Changes to package dependencies[^1] - [x] `documentation` — Changes to the documentation only[^2] - [ ] `tests` — Changes to any test code only[^2] - [ ] `internal` — Any other changes that don't affect the published package[^2] - [ ] I don't know [^1]: publishes a `patch` release, for devDependencies use `internal` [^2]: will not publish a new version ### Release Notes - Remove examples app landing page
This commit is contained in:
parent
23f60ee98e
commit
a51ffb9544
2 changed files with 14 additions and 26 deletions
|
@ -1,24 +0,0 @@
|
|||
import { ExamplesLink } from './components/ExamplesLink'
|
||||
import ExamplesTldrawLogo from './components/ExamplesTldrawLogo'
|
||||
import { examples } from './examples'
|
||||
|
||||
export function HomePage() {
|
||||
return (
|
||||
<div className="examples">
|
||||
<div className="examples__header">
|
||||
<div className="examples__title">
|
||||
<ExamplesTldrawLogo /> examples
|
||||
</div>
|
||||
<p>
|
||||
See docs at <a href="https://tldraw.dev">tldraw.dev</a>
|
||||
</p>
|
||||
</div>
|
||||
<ul className="examples__list">
|
||||
{examples.map((e) =>
|
||||
e.value.map((e) => <ExamplesLink key={e.path} example={e} showDescriptionWhenInactive />)
|
||||
)}
|
||||
</ul>
|
||||
<hr />
|
||||
</div>
|
||||
)
|
||||
}
|
|
@ -8,7 +8,6 @@ import {
|
|||
import { createRoot } from 'react-dom/client'
|
||||
import { RouterProvider, createBrowserRouter } from 'react-router-dom'
|
||||
import { ExamplePage } from './ExamplePage'
|
||||
import { HomePage } from './HomePage'
|
||||
import { examples } from './examples'
|
||||
import EndToEnd from './testing/end-to-end'
|
||||
|
||||
|
@ -19,11 +18,24 @@ import EndToEnd from './testing/end-to-end'
|
|||
const assetUrls = getAssetUrlsByMetaUrl()
|
||||
setDefaultEditorAssetUrls(assetUrls)
|
||||
setDefaultUiAssetUrls(assetUrls)
|
||||
const gettingStartedExamples = examples.find((e) => e.id === 'Getting Started')
|
||||
if (!gettingStartedExamples) throw new Error('Could not find getting started exmaples')
|
||||
const basicExample = gettingStartedExamples.value.find((e) => e.title === 'Basic')
|
||||
if (!basicExample) throw new Error('Could not find basic example')
|
||||
|
||||
const router = createBrowserRouter([
|
||||
{
|
||||
path: '/',
|
||||
element: <HomePage />,
|
||||
lazy: async () => {
|
||||
const Component = await basicExample.loadComponent()
|
||||
return {
|
||||
element: (
|
||||
<ExamplePage example={basicExample}>
|
||||
<Component />
|
||||
</ExamplePage>
|
||||
),
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'end-to-end',
|
||||
|
|
Loading…
Reference in a new issue