Fix embed examples

pull/8432/head
Puru Vijay 3 years ago
parent fd407a78c8
commit 810a4abdfd

@ -10,9 +10,6 @@ export function get_examples_data(base = BASE) {
const examples = [];
for (const subdir of fs.readdirSync(base)) {
// Exclude embeds
if (subdir.endsWith('99-embeds')) continue;
const section = {
title: '', // Initialise with empty
slug: subdir.split('-').slice(1).join('-'),

@ -15,36 +15,38 @@
</svelte:head>
<Shell nav_visible={$page.url.pathname !== '/repl/embed'}>
<Nav logo="/svelte-logo.svg">
<svelte:fragment slot="nav-center">
{#if $page.url.pathname !== '/search'}
<li><Search /></li>
{/if}
</svelte:fragment>
{#if $page.url.pathname !== '/repl/embed'}
<Nav logo="/svelte-logo.svg">
<svelte:fragment slot="nav-center">
{#if $page.url.pathname !== '/search'}
<li><Search /></li>
{/if}
</svelte:fragment>
<svelte:fragment slot="nav-right">
<NavItem href="/tutorial">Tutorial</NavItem>
<NavItem href="/docs/introduction">Docs</NavItem>
<NavItem href="/examples">Examples</NavItem>
<NavItem href="/repl">REPL</NavItem>
<NavItem href="/blog">Blog</NavItem>
<NavItem href="/faq">FAQ</NavItem>
<svelte:fragment slot="nav-right">
<NavItem href="/tutorial">Tutorial</NavItem>
<NavItem href="/docs/introduction">Docs</NavItem>
<NavItem href="/examples">Examples</NavItem>
<NavItem href="/repl">REPL</NavItem>
<NavItem href="/blog">Blog</NavItem>
<NavItem href="/faq">FAQ</NavItem>
<Separator />
<Separator />
<NavItem external="https://kit.svelte.dev">SvelteKit</NavItem>
<NavItem external="https://kit.svelte.dev">SvelteKit</NavItem>
<NavItem external="/chat" title="Discord Chat">
<span slot="small">Discord</span>
<Icon name="message-square" />
</NavItem>
<NavItem external="/chat" title="Discord Chat">
<span slot="small">Discord</span>
<Icon name="message-square" />
</NavItem>
<NavItem external="https://github.com/sveltejs/svelte" title="GitHub Repo">
<span slot="small">GitHub</span>
<Icon name="github" />
</NavItem>
</svelte:fragment>
</Nav>
<NavItem external="https://github.com/sveltejs/svelte" title="GitHub Repo">
<span slot="small">GitHub</span>
<Icon name="github" />
</NavItem>
</svelte:fragment>
</Nav>
{/if}
<slot />
</Shell>

@ -14,31 +14,33 @@
<ul class="examples-toc">
{#each sections as section}
<li>
<span class="section-title">{section.title}</span>
{#each section.examples as example}
<div class="row" class:active={example.slug === active_section} class:loading={isLoading}>
<a
href="/examples/{example.slug}"
class="row"
class:active={example.slug === active_section}
class:loading={isLoading}
>
<img
class="thumbnail"
alt="{example.title} thumbnail"
src="/examples/thumbnails/{example.slug}.jpg"
/>
<span>{example.title}</span>
</a>
{#if example.slug === active_section}
<a bind:this={active_el} href="/repl/{example.slug}" class="repl-link">REPL</a>
{/if}
</div>
{/each}
</li>
{#if section.title !== undefined}
<li>
<span class="section-title">{section.title}</span>
{#each section.examples as example}
<div class="row" class:active={example.slug === active_section} class:loading={isLoading}>
<a
href="/examples/{example.slug}"
class="row"
class:active={example.slug === active_section}
class:loading={isLoading}
>
<img
class="thumbnail"
alt="{example.title} thumbnail"
src="/examples/thumbnails/{example.slug}.jpg"
/>
<span>{example.title}</span>
</a>
{#if example.slug === active_section}
<a bind:this={active_el} href="/repl/{example.slug}" class="repl-link">REPL</a>
{/if}
</div>
{/each}
</li>
{/if}
{/each}
</ul>

Loading…
Cancel
Save