Fix HTML and CSS order and format CSS.

pull/6213/head
Babak F 5 years ago
parent 93f52e6d96
commit 7631e2eabc

@ -5,12 +5,6 @@
let text = 'edit me'; let text = 'edit me';
</script> </script>
<style>
input { display: block; }
div { display: inline-block; }
span { word-break: break-all; }
</style>
<input type=range bind:value={size}> <input type=range bind:value={size}>
<input bind:value={text}> <input bind:value={text}>
@ -19,3 +13,15 @@
<div> <div>
<span style="font-size: {size}px">{text}</span> <span style="font-size: {size}px">{text}</span>
</div> </div>
<style>
input {
display: block;
}
div {
display: inline-block;
}
span {
word-break: break-all;
}
</style>

@ -5,12 +5,6 @@
let text = 'edit me'; let text = 'edit me';
</script> </script>
<style>
input { display: block; }
div { display: inline-block; }
span { word-break: break-all; }
</style>
<input type=range bind:value={size}> <input type=range bind:value={size}>
<input bind:value={text}> <input bind:value={text}>
@ -19,3 +13,15 @@
<div bind:clientWidth={w} bind:clientHeight={h}> <div bind:clientWidth={w} bind:clientHeight={h}>
<span style="font-size: {size}px">{text}</span> <span style="font-size: {size}px">{text}</span>
</div> </div>
<style>
input {
display: block;
}
div {
display: inline-block;
}
span {
word-break: break-all;
}
</style>

@ -36,6 +36,11 @@
}); });
</script> </script>
<canvas
width={32}
height={32}
></canvas>
<style> <style>
canvas { canvas {
width: 100%; width: 100%;
@ -45,8 +50,3 @@
mask: url(svelte-logo-mask.svg) 50% 50% no-repeat; mask: url(svelte-logo-mask.svg) 50% 50% no-repeat;
} }
</style> </style>
<canvas
width={32}
height={32}
></canvas>

@ -36,6 +36,12 @@
}); });
</script> </script>
<canvas
bind:this={canvas}
width={32}
height={32}
></canvas>
<style> <style>
canvas { canvas {
width: 100%; width: 100%;
@ -45,9 +51,3 @@
mask: url(svelte-logo-mask.svg) 50% 50% no-repeat; mask: url(svelte-logo-mask.svg) 50% 50% no-repeat;
} }
</style> </style>
<canvas
bind:this={canvas}
width={32}
height={32}
></canvas>

@ -10,19 +10,6 @@
const submit = () => dispatch('submit'); const submit = () => dispatch('submit');
</script> </script>
<style>
.keypad {
display: grid;
grid-template-columns: repeat(3, 5em);
grid-template-rows: repeat(4, 3em);
grid-gap: 0.5em
}
button {
margin: 0
}
</style>
<div class="keypad"> <div class="keypad">
<button on:click={select(1)}>1</button> <button on:click={select(1)}>1</button>
<button on:click={select(2)}>2</button> <button on:click={select(2)}>2</button>
@ -38,3 +25,16 @@
<button on:click={select(0)}>0</button> <button on:click={select(0)}>0</button>
<button disabled={!value} on:click={submit}>submit</button> <button disabled={!value} on:click={submit}>submit</button>
</div> </div>
<style>
.keypad {
display: grid;
grid-template-columns: repeat(3, 5em);
grid-template-rows: repeat(4, 3em);
grid-gap: 0.5em
}
button {
margin: 0
}
</style>

@ -10,19 +10,6 @@
const submit = () => dispatch('submit'); const submit = () => dispatch('submit');
</script> </script>
<style>
.keypad {
display: grid;
grid-template-columns: repeat(3, 5em);
grid-template-rows: repeat(4, 3em);
grid-gap: 0.5em
}
button {
margin: 0
}
</style>
<div class="keypad"> <div class="keypad">
<button on:click={select(1)}>1</button> <button on:click={select(1)}>1</button>
<button on:click={select(2)}>2</button> <button on:click={select(2)}>2</button>
@ -38,3 +25,16 @@
<button on:click={select(0)}>0</button> <button on:click={select(0)}>0</button>
<button disabled={!value} on:click={submit}>submit</button> <button disabled={!value} on:click={submit}>submit</button>
</div> </div>
<style>
.keypad {
display: grid;
grid-template-columns: repeat(3, 5em);
grid-template-rows: repeat(4, 3em);
grid-gap: 0.5em
}
button {
margin: 0
}
</style>

@ -2,20 +2,6 @@
let photos = []; let photos = [];
</script> </script>
<style>
.photos {
width: 100%;
display: grid;
grid-template-columns: repeat(5, 1fr);
grid-gap: 8px;
}
figure, img {
width: 100%;
margin: 0;
}
</style>
<h1>Photo album</h1> <h1>Photo album</h1>
<div class="photos"> <div class="photos">
@ -29,3 +15,17 @@
<p>loading...</p> <p>loading...</p>
{/each} {/each}
</div> </div>
<style>
.photos {
width: 100%;
display: grid;
grid-template-columns: repeat(5, 1fr);
grid-gap: 8px;
}
figure, img {
width: 100%;
margin: 0;
}
</style>

@ -9,20 +9,6 @@
}); });
</script> </script>
<style>
.photos {
width: 100%;
display: grid;
grid-template-columns: repeat(5, 1fr);
grid-gap: 8px;
}
figure, img {
width: 100%;
margin: 0;
}
</style>
<h1>Photo album</h1> <h1>Photo album</h1>
<div class="photos"> <div class="photos">
@ -36,3 +22,17 @@
<p>loading...</p> <p>loading...</p>
{/each} {/each}
</div> </div>
<style>
.photos {
width: 100%;
display: grid;
grid-template-columns: repeat(5, 1fr);
grid-gap: 8px;
}
figure, img {
width: 100%;
margin: 0;
}
</style>

@ -4,13 +4,6 @@
const progress = writable(0); const progress = writable(0);
</script> </script>
<style>
progress {
display: block;
width: 100%;
}
</style>
<progress value={$progress}></progress> <progress value={$progress}></progress>
<button on:click="{() => progress.set(0)}"> <button on:click="{() => progress.set(0)}">
@ -32,3 +25,10 @@
<button on:click="{() => progress.set(1)}"> <button on:click="{() => progress.set(1)}">
100% 100%
</button> </button>
<style>
progress {
display: block;
width: 100%;
}
</style>

@ -8,13 +8,6 @@
}); });
</script> </script>
<style>
progress {
display: block;
width: 100%;
}
</style>
<progress value={$progress}></progress> <progress value={$progress}></progress>
<button on:click="{() => progress.set(0)}"> <button on:click="{() => progress.set(0)}">
@ -36,3 +29,10 @@
<button on:click="{() => progress.set(1)}"> <button on:click="{() => progress.set(1)}">
100% 100%
</button> </button>
<style>
progress {
display: block;
width: 100%;
}
</style>

@ -5,11 +5,6 @@
let size = writable(10); let size = writable(10);
</script> </script>
<style>
svg { width: 100%; height: 100%; margin: -8px; }
circle { fill: #ff3e00 }
</style>
<div style="position: absolute; right: 1em;"> <div style="position: absolute; right: 1em;">
<label> <label>
<h3>stiffness ({coords.stiffness})</h3> <h3>stiffness ({coords.stiffness})</h3>
@ -29,3 +24,14 @@
> >
<circle cx={$coords.x} cy={$coords.y} r={$size}/> <circle cx={$coords.x} cy={$coords.y} r={$size}/>
</svg> </svg>
<style>
svg {
width: 100%;
height: 100%;
margin: -8px;
}
circle {
fill: #ff3e00;
}
</style>

@ -9,11 +9,6 @@
let size = spring(10); let size = spring(10);
</script> </script>
<style>
svg { width: 100%; height: 100% }
circle { fill: #ff3e00 }
</style>
<div style="position: absolute; right: 1em;"> <div style="position: absolute; right: 1em;">
<label> <label>
<h3>stiffness ({coords.stiffness})</h3> <h3>stiffness ({coords.stiffness})</h3>
@ -33,3 +28,13 @@
> >
<circle cx={$coords.x} cy={$coords.y} r={$size}/> <circle cx={$coords.x} cy={$coords.y} r={$size}/>
</svg> </svg>
<style>
svg {
width: 100%;
height: 100%;
}
circle {
fill: #ff3e00;
}
</style>

@ -11,6 +11,17 @@
} }
</script> </script>
<label>
<input type="checkbox" bind:checked={visible}>
visible
</label>
{#if visible}
<div class="centered" in:spin="{{duration: 8000}}" out:fade>
<span>transitions!</span>
</div>
{/if}
<style> <style>
.centered { .centered {
position: absolute; position: absolute;
@ -25,14 +36,3 @@
font-size: 4em; font-size: 4em;
} }
</style> </style>
<label>
<input type="checkbox" bind:checked={visible}>
visible
</label>
{#if visible}
<div class="centered" in:spin="{{duration: 8000}}" out:fade>
<span>transitions!</span>
</div>
{/if}

@ -22,6 +22,17 @@
} }
</script> </script>
<label>
<input type="checkbox" bind:checked={visible}>
visible
</label>
{#if visible}
<div class="centered" in:spin="{{duration: 8000}}" out:fade>
<span>transitions!</span>
</div>
{/if}
<style> <style>
.centered { .centered {
position: absolute; position: absolute;
@ -36,14 +47,3 @@
font-size: 4em; font-size: 4em;
} }
</style> </style>
<label>
<input type="checkbox" bind:checked={visible}>
visible
</label>
{#if visible}
<div class="centered" in:spin="{{duration: 8000}}" out:fade>
<span>transitions!</span>
</div>
{/if}

@ -6,13 +6,6 @@
let items = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten']; let items = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten'];
</script> </script>
<style>
div {
padding: 0.5em 0;
border-top: 1px solid #eee;
}
</style>
<label> <label>
<input type="checkbox" bind:checked={showItems}> <input type="checkbox" bind:checked={showItems}>
show list show list
@ -30,3 +23,10 @@
</div> </div>
{/each} {/each}
{/if} {/if}
<style>
div {
padding: 0.5em 0;
border-top: 1px solid #eee;
}
</style>

@ -6,13 +6,6 @@
let items = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten']; let items = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten'];
</script> </script>
<style>
div {
padding: 0.5em 0;
border-top: 1px solid #eee;
}
</style>
<label> <label>
<input type="checkbox" bind:checked={showItems}> <input type="checkbox" bind:checked={showItems}>
show list show list
@ -30,3 +23,10 @@
</div> </div>
{/each} {/each}
{/if} {/if}
<style>
div {
padding: 0.5em 0;
border-top: 1px solid #eee;
}
</style>

@ -2,17 +2,6 @@
let current = 'foo'; let current = 'foo';
</script> </script>
<style>
button {
display: block;
}
.selected {
background-color: #ff3e00;
color: white;
}
</style>
<button <button
class="{current === 'foo' ? 'selected' : ''}" class="{current === 'foo' ? 'selected' : ''}"
on:click="{() => current = 'foo'}" on:click="{() => current = 'foo'}"
@ -27,3 +16,14 @@
class="{current === 'baz' ? 'selected' : ''}" class="{current === 'baz' ? 'selected' : ''}"
on:click="{() => current = 'baz'}" on:click="{() => current = 'baz'}"
>baz</button> >baz</button>
<style>
button {
display: block;
}
.selected {
background-color: #ff3e00;
color: white;
}
</style>

@ -2,17 +2,6 @@
let current = 'foo'; let current = 'foo';
</script> </script>
<style>
button {
display: block;
}
.selected {
background-color: #ff3e00;
color: white;
}
</style>
<button <button
class:selected="{current === 'foo'}" class:selected="{current === 'foo'}"
on:click="{() => current = 'foo'}" on:click="{() => current = 'foo'}"
@ -27,3 +16,14 @@
class:selected="{current === 'baz'}" class:selected="{current === 'baz'}"
on:click="{() => current = 'baz'}" on:click="{() => current = 'baz'}"
>baz</button> >baz</button>
<style>
button {
display: block;
}
.selected {
background-color: #ff3e00;
color: white;
}
</style>

@ -2,12 +2,6 @@
let big = false; let big = false;
</script> </script>
<style>
.big {
font-size: 4em;
}
</style>
<label> <label>
<input type=checkbox bind:checked={big}> <input type=checkbox bind:checked={big}>
big big
@ -16,3 +10,9 @@
<div class:big={big}> <div class:big={big}>
some {big ? 'big' : 'small'} text some {big ? 'big' : 'small'} text
</div> </div>
<style>
.big {
font-size: 4em;
}
</style>

@ -1,3 +1,7 @@
<div class="box">
<!-- content should be injected here -->
</div>
<style> <style>
.box { .box {
width: 300px; width: 300px;
@ -8,7 +12,3 @@
margin: 0 0 1em 0; margin: 0 0 1em 0;
} }
</style> </style>
<div class="box">
<!-- content should be injected here -->
</div>

@ -1,3 +1,7 @@
<div class="box">
<slot></slot>
</div>
<style> <style>
.box { .box {
width: 300px; width: 300px;
@ -8,7 +12,3 @@
margin: 0 0 1em 0; margin: 0 0 1em 0;
} }
</style> </style>
<div class="box">
<slot></slot>
</div>

@ -1,3 +1,7 @@
<div class="box">
<slot></slot>
</div>
<style> <style>
.box { .box {
width: 300px; width: 300px;
@ -8,7 +12,3 @@
margin: 0 0 1em 0; margin: 0 0 1em 0;
} }
</style> </style>
<div class="box">
<slot></slot>
</div>

@ -1,3 +1,9 @@
<div class="box">
<slot>
<em>no content was provided</em>
</slot>
</div>
<style> <style>
.box { .box {
width: 300px; width: 300px;
@ -8,9 +14,3 @@
margin: 0 0 1em 0; margin: 0 0 1em 0;
} }
</style> </style>
<div class="box">
<slot>
<em>no content was provided</em>
</slot>
</div>

@ -1,3 +1,23 @@
<article class="contact-card">
<h2>
<slot>
<span class="missing">Unknown name</span>
</slot>
</h2>
<div class="address">
<slot>
<span class="missing">Unknown address</span>
</slot>
</div>
<div class="email">
<slot>
<span class="missing">Unknown email</span>
</slot>
</div>
</article>
<style> <style>
.contact-card { .contact-card {
width: 300px; width: 300px;
@ -21,27 +41,13 @@
line-height: 1.2; line-height: 1.2;
} }
.address { background-image: url(tutorial/icons/map-marker.svg) } .address {
.email { background-image: url(tutorial/icons/email.svg) } background-image: url(tutorial/icons/map-marker.svg);
.missing { color: #999 } }
.email {
background-image: url(tutorial/icons/email.svg);
}
.missing {
color: #999;
}
</style> </style>
<article class="contact-card">
<h2>
<slot>
<span class="missing">Unknown name</span>
</slot>
</h2>
<div class="address">
<slot>
<span class="missing">Unknown address</span>
</slot>
</div>
<div class="email">
<slot>
<span class="missing">Unknown email</span>
</slot>
</div>
</article>

@ -1,3 +1,23 @@
<article class="contact-card">
<h2>
<slot name="name">
<span class="missing">Unknown name</span>
</slot>
</h2>
<div class="address">
<slot name="address">
<span class="missing">Unknown address</span>
</slot>
</div>
<div class="email">
<slot name="email">
<span class="missing">Unknown email</span>
</slot>
</div>
</article>
<style> <style>
.contact-card { .contact-card {
width: 300px; width: 300px;
@ -21,27 +41,13 @@
line-height: 1.2; line-height: 1.2;
} }
.address { background-image: url(tutorial/icons/map-marker.svg) } .address {
.email { background-image: url(tutorial/icons/email.svg) } background-image: url(tutorial/icons/map-marker.svg);
.missing { color: #999 } }
.email {
background-image: url(tutorial/icons/email.svg);
}
.missing {
color: #999;
}
</style> </style>
<article class="contact-card">
<h2>
<slot name="name">
<span class="missing">Unknown name</span>
</slot>
</h2>
<div class="address">
<slot name="address">
<span class="missing">Unknown address</span>
</slot>
</div>
<div class="email">
<slot name="email">
<span class="missing">Unknown email</span>
</slot>
</div>
</article>

@ -3,32 +3,6 @@
import Comment from './Comment.svelte' import Comment from './Comment.svelte'
</script> </script>
<style>
h1 {
font-weight: 300;
margin: 0 1rem;
}
ul {
list-style: none;
padding: 0;
margin: 0.5rem;
display: flex;
}
@media (max-width: 600px) {
ul {
flex-direction: column;
}
}
li {
padding: 0.5rem;
flex: 1 1 50%;
min-width: 200px;
}
</style>
<h1> <h1>
Projects Projects
</h1> </h1>
@ -55,3 +29,29 @@
/> />
</li> </li>
</ul> </ul>
<style>
h1 {
font-weight: 300;
margin: 0 1rem;
}
ul {
list-style: none;
padding: 0;
margin: 0.5rem;
display: flex;
}
@media (max-width: 600px) {
ul {
flex-direction: column;
}
}
li {
padding: 0.5rem;
flex: 1 1 50%;
min-width: 200px;
}
</style>

@ -5,6 +5,19 @@
$: avatar = `https://ui-avatars.com/api/?name=${name.replace(/ /g, '+')}&rounded=true&background=ff3e00&color=fff&bold=true`; $: avatar = `https://ui-avatars.com/api/?name=${name.replace(/ /g, '+')}&rounded=true&background=ff3e00&color=fff&bold=true`;
</script> </script>
<article>
<div class="header">
<img src={avatar} alt="" height="32" width="32">
<div class="details">
<h4>{name}</h4>
<time datetime={postedAt.toISOString()}>{postedAt.toLocaleDateString()}</time>
</div>
</div>
<div class="body">
<slot></slot>
</div>
</article>
<style> <style>
article { article {
background-color: #fff; background-color: #fff;
@ -41,16 +54,3 @@
margin: 0; margin: 0;
} }
</style> </style>
<article>
<div class="header">
<img src={avatar} alt="" height="32" width="32">
<div class="details">
<h4>{name}</h4>
<time datetime={postedAt.toISOString()}>{postedAt.toLocaleDateString()}</time>
</div>
</div>
<div class="body">
<slot></slot>
</div>
</article>

@ -4,6 +4,17 @@
export let totalTasks = 0; export let totalTasks = 0;
</script> </script>
<article class:has-discussion={true}>
<div>
<h2>{title}</h2>
<p>{tasksCompleted}/{totalTasks} tasks completed</p>
</div>
<div class="discussion">
<h3>Comments</h3>
<slot name="comments"></slot>
</div>
</article>
<style> <style>
article { article {
border: 1px #ccc solid; border: 1px #ccc solid;
@ -49,14 +60,3 @@
border-top: 1px #ccc solid; border-top: 1px #ccc solid;
} }
</style> </style>
<article class:has-discussion={true}>
<div>
<h2>{title}</h2>
<p>{tasksCompleted}/{totalTasks} tasks completed</p>
</div>
<div class="discussion">
<h3>Comments</h3>
<slot name="comments"></slot>
</div>
</article>

@ -3,32 +3,6 @@
import Comment from './Comment.svelte' import Comment from './Comment.svelte'
</script> </script>
<style>
h1 {
font-weight: 300;
margin: 0 1rem;
}
ul {
list-style: none;
padding: 0;
margin: 0.5rem;
display: flex;
}
@media (max-width: 600px) {
ul {
flex-direction: column;
}
}
li {
padding: 0.5rem;
flex: 1 1 50%;
min-width: 200px;
}
</style>
<h1> <h1>
Projects Projects
</h1> </h1>
@ -55,3 +29,29 @@
/> />
</li> </li>
</ul> </ul>
<style>
h1 {
font-weight: 300;
margin: 0 1rem;
}
ul {
list-style: none;
padding: 0;
margin: 0.5rem;
display: flex;
}
@media (max-width: 600px) {
ul {
flex-direction: column;
}
}
li {
padding: 0.5rem;
flex: 1 1 50%;
min-width: 200px;
}
</style>

@ -5,6 +5,19 @@
$: avatar = `https://ui-avatars.com/api/?name=${name.replace(/ /g, '+')}&rounded=true&background=ff3e00&color=fff&bold=true`; $: avatar = `https://ui-avatars.com/api/?name=${name.replace(/ /g, '+')}&rounded=true&background=ff3e00&color=fff&bold=true`;
</script> </script>
<article>
<div class="header">
<img src={avatar} alt="" height="32" width="32">
<div class="details">
<h4>{name}</h4>
<time datetime={postedAt.toISOString()}>{postedAt.toLocaleDateString()}</time>
</div>
</div>
<div class="body">
<slot></slot>
</div>
</article>
<style> <style>
article { article {
background-color: #fff; background-color: #fff;
@ -41,16 +54,3 @@
margin: 0; margin: 0;
} }
</style> </style>
<article>
<div class="header">
<img src={avatar} alt="" height="32" width="32">
<div class="details">
<h4>{name}</h4>
<time datetime={postedAt.toISOString()}>{postedAt.toLocaleDateString()}</time>
</div>
</div>
<div class="body">
<slot></slot>
</div>
</article>

@ -4,6 +4,19 @@
export let totalTasks = 0; export let totalTasks = 0;
</script> </script>
<article class:has-discussion={$$slots.comments}>
<div>
<h2>{title}</h2>
<p>{tasksCompleted}/{totalTasks} tasks completed</p>
</div>
{#if $$slots.comments}
<div class="discussion">
<h3>Comments</h3>
<slot name="comments"></slot>
</div>
{/if}
</article>
<style> <style>
article { article {
border: 1px #ccc solid; border: 1px #ccc solid;
@ -49,16 +62,3 @@
border-top: 1px #ccc solid; border-top: 1px #ccc solid;
} }
</style> </style>
<article class:has-discussion={$$slots.comments}>
<div>
<h2>{title}</h2>
<p>{tasksCompleted}/{totalTasks} tasks completed</p>
</div>
{#if $$slots.comments}
<div class="discussion">
<h3>Comments</h3>
<slot name="comments"></slot>
</div>
{/if}
</article>

@ -2,6 +2,16 @@
import Hoverable from './Hoverable.svelte'; import Hoverable from './Hoverable.svelte';
</script> </script>
<Hoverable>
<div class:active={hovering}>
{#if hovering}
<p>I am being hovered upon.</p>
{:else}
<p>Hover over me!</p>
{/if}
</div>
</Hoverable>
<style> <style>
div { div {
padding: 1em; padding: 1em;
@ -14,13 +24,3 @@
color: white; color: white;
} }
</style> </style>
<Hoverable>
<div class:active={hovering}>
{#if hovering}
<p>I am being hovered upon.</p>
{:else}
<p>Hover over me!</p>
{/if}
</div>
</Hoverable>

@ -2,19 +2,6 @@
import Hoverable from './Hoverable.svelte'; import Hoverable from './Hoverable.svelte';
</script> </script>
<style>
div {
padding: 1em;
margin: 0 0 1em 0;
background-color: #eee;
}
.active {
background-color: #ff3e00;
color: white;
}
</style>
<Hoverable let:hovering={active}> <Hoverable let:hovering={active}>
<div class:active> <div class:active>
{#if active} {#if active}
@ -44,3 +31,16 @@
{/if} {/if}
</div> </div>
</Hoverable> </Hoverable>
<style>
div {
padding: 1em;
margin: 0 0 1em 0;
background-color: #eee;
}
.active {
background-color: #ff3e00;
color: white;
}
</style>

@ -34,15 +34,15 @@
}); });
</script> </script>
<div bind:this={container}>
{#if map}
<slot></slot>
{/if}
</div>
<style> <style>
div { div {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
</style> </style>
<div bind:this={container}>
{#if map}
<slot></slot>
{/if}
</div>

@ -36,15 +36,15 @@
}); });
</script> </script>
<div bind:this={container}>
{#if map}
<slot></slot>
{/if}
</div>
<style> <style>
div { div {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
</style> </style>
<div bind:this={container}>
{#if map}
<slot></slot>
{/if}
</div>

@ -3,6 +3,8 @@
$: type = name.slice(name.lastIndexOf('.') + 1); $: type = name.slice(name.lastIndexOf('.') + 1);
</script> </script>
<span style="background-image: url(tutorial/icons/{type}.svg)">{name}</span>
<style> <style>
span { span {
padding: 0 0 0 1.5em; padding: 0 0 0 1.5em;
@ -10,5 +12,3 @@
background-size: 1em 1em; background-size: 1em 1em;
} }
</style> </style>
<span style="background-image: url(tutorial/icons/{type}.svg)">{name}</span>

@ -10,6 +10,22 @@
} }
</script> </script>
<span class:expanded on:click={toggle}>{name}</span>
{#if expanded}
<ul>
{#each files as file}
<li>
{#if file.type === 'folder'}
<!-- show folder -->
{:else}
<File {...file}/>
{/if}
</li>
{/each}
</ul>
{/if}
<style> <style>
span { span {
padding: 0 0 0 1.5em; padding: 0 0 0 1.5em;
@ -34,19 +50,3 @@
padding: 0.2em 0; padding: 0.2em 0;
} }
</style> </style>
<span class:expanded on:click={toggle}>{name}</span>
{#if expanded}
<ul>
{#each files as file}
<li>
{#if file.type === 'folder'}
<!-- show folder -->
{:else}
<File {...file}/>
{/if}
</li>
{/each}
</ul>
{/if}

@ -3,6 +3,8 @@
$: type = name.slice(name.lastIndexOf('.') + 1); $: type = name.slice(name.lastIndexOf('.') + 1);
</script> </script>
<span style="background-image: url(tutorial/icons/{type}.svg)">{name}</span>
<style> <style>
span { span {
padding: 0 0 0 1.5em; padding: 0 0 0 1.5em;
@ -10,5 +12,3 @@
background-size: 1em 1em; background-size: 1em 1em;
} }
</style> </style>
<span style="background-image: url(tutorial/icons/{type}.svg)">{name}</span>

@ -10,6 +10,22 @@
} }
</script> </script>
<span class:expanded on:click={toggle}>{name}</span>
{#if expanded}
<ul>
{#each files as file}
<li>
{#if file.type === 'folder'}
<svelte:self {...file}/>
{:else}
<File {...file}/>
{/if}
</li>
{/each}
</ul>
{/if}
<style> <style>
span { span {
padding: 0 0 0 1.5em; padding: 0 0 0 1.5em;
@ -34,19 +50,3 @@
padding: 0.2em 0; padding: 0.2em 0;
} }
</style> </style>
<span class:expanded on:click={toggle}>{name}</span>
{#if expanded}
<ul>
{#each files as file}
<li>
{#if file.type === 'folder'}
<svelte:self {...file}/>
{:else}
<File {...file}/>
{/if}
</li>
{/each}
</ul>
{/if}
Loading…
Cancel
Save