Skip to content

Commit

Permalink
group demo routes
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed Feb 13, 2023
1 parent 35f7fbe commit 89aae68
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 15 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"rehype-slug": "^5.1.0",
"svelte": "^3.55.1",
"svelte-check": "^3.0.2",
"svelte-github-corner": "^0.2.0",
"svelte-multiselect": "^8.2.4",
"svelte-preprocess": "^5.0.0",
"svelte-toc": "^0.5.1",
Expand Down
3 changes: 3 additions & 0 deletions src/routes/(demos)/+layout.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<main>
<slot />
</main>
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 2 additions & 4 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { page } from '$app/stores'
import { name, repository } from '$root/package.json'
import { Footer } from '$site'
import GitHubCorner from 'svelte-github-corner'
import { GitHubCorner } from 'svelte-zoo'
import '../app.css'
import { _demo_routes } from './+layout'
Expand Down Expand Up @@ -30,9 +30,7 @@
{/each}
</nav>

<main>
<slot />
</main>
<slot />
{:else}
<!-- handles non-svx routes index.svelte and +error.svelte -->
<slot />
Expand Down
11 changes: 5 additions & 6 deletions src/routes/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ import type { LayoutLoad } from './$types'

export const prerender = true

export const _demo_routes = Object.keys(import.meta.glob(`./*/+page.{svx,md}`))
.map((filename) => filename.split(`/`)[1])
.filter(
(name) => ![`contributing`, `changelog`, `acknowledgements`].includes(name)
)
export const _demo_routes = Object.keys(
// eslint-disable-next-line @typescript-eslint/quotes
import.meta.glob('./\\(demos\\)/*/+page*.{svx,md,svelte}')
).map((filename) => filename.split(`/`)[2])

if (_demo_routes.length < 2) {
if (_demo_routes.length < 3) {
throw new Error(`Too few demo routes found: ${_demo_routes.length}`)
}

Expand Down
4 changes: 0 additions & 4 deletions src/site/Footer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
<Icon icon="fa6-solid:hands-clapping" />Acknowledgements
</a>
<strong>&ensp;&bull;&ensp;</strong>
<a href="/bohr-atoms">
<Icon icon="mdi:atom-variant" />Bohr Atoms
</a>
<strong>&ensp;&bull;&ensp;</strong>
<a href="/changelog">
<Icon icon="octicon:history" />Changelog
</a>
Expand Down

0 comments on commit 89aae68

Please sign in to comment.