Spaces:
Running
Running
cooler app w/ color shadows 🔥
Browse files- src/App.svelte +10 -2
- src/Nested.svelte +19 -0
src/App.svelte
CHANGED
|
@@ -1,11 +1,19 @@
|
|
| 1 |
<script lang="ts">
|
|
|
|
|
|
|
| 2 |
export let name = "World";
|
|
|
|
|
|
|
| 3 |
</script>
|
| 4 |
|
| 5 |
-
<main>
|
| 6 |
-
<h1 class="text-red-
|
| 7 |
<p>
|
| 8 |
Visit the <a href="https://svelte.dev/tutorial">Svelte tutorial</a> to learn
|
| 9 |
how to build Svelte apps.
|
| 10 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
</main>
|
|
|
|
| 1 |
<script lang="ts">
|
| 2 |
+
import Nested from "./Nested.svelte";
|
| 3 |
+
|
| 4 |
export let name = "World";
|
| 5 |
+
|
| 6 |
+
const colors = ["cyan", "blue", "indigo"];
|
| 7 |
</script>
|
| 8 |
|
| 9 |
+
<main class="m-3">
|
| 10 |
+
<h1 class="text-red-400 font-mono">Hello {name}!</h1>
|
| 11 |
<p>
|
| 12 |
Visit the <a href="https://svelte.dev/tutorial">Svelte tutorial</a> to learn
|
| 13 |
how to build Svelte apps.
|
| 14 |
</p>
|
| 15 |
+
|
| 16 |
+
{#each colors as color}
|
| 17 |
+
<Nested {color} />
|
| 18 |
+
{/each}
|
| 19 |
</main>
|
src/Nested.svelte
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script lang="ts">
|
| 2 |
+
export let color: string;
|
| 3 |
+
|
| 4 |
+
let i = 0;
|
| 5 |
+
</script>
|
| 6 |
+
|
| 7 |
+
<!-- tailwind
|
| 8 |
+
<button class="bg-cyan-500 shadow-lg shadow-cyan-500/50 ...">Subscribe</button>
|
| 9 |
+
<button class="bg-blue-500 shadow-lg shadow-blue-500/50 ...">Subscribe</button>
|
| 10 |
+
<button class="bg-indigo-500 shadow-lg shadow-indigo-500/50 ...">Subscribe</button>
|
| 11 |
+
-->
|
| 12 |
+
|
| 13 |
+
<div
|
| 14 |
+
class="cursor-pointer select-none rounded px-4 py-3 mt-3 bg-{color}-500 shadow-lg shadow-{color}-500/50"
|
| 15 |
+
on:click={() => i++}
|
| 16 |
+
>
|
| 17 |
+
Counter {color}
|
| 18 |
+
{i}
|
| 19 |
+
</div>
|