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 = []; const examples = [];
for (const subdir of fs.readdirSync(base)) { for (const subdir of fs.readdirSync(base)) {
// Exclude embeds
if (subdir.endsWith('99-embeds')) continue;
const section = { const section = {
title: '', // Initialise with empty title: '', // Initialise with empty
slug: subdir.split('-').slice(1).join('-'), slug: subdir.split('-').slice(1).join('-'),

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

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

Loading…
Cancel
Save