Moved components to lib folder; slide animation for announcement bar
This commit is contained in:
@@ -5,15 +5,20 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { slide } from 'svelte/transition';
|
||||||
export let message;
|
export let message;
|
||||||
export let color = 'red';
|
export let color = 'red';
|
||||||
let noderef;
|
let noderef;
|
||||||
|
|
||||||
|
let visible = true;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div bind:this={noderef} class="announcement" style="background-color: {color};">
|
{#if visible}
|
||||||
<span>{message}</span>
|
<div transition:slide bind:this={noderef} class="announcement" style="background-color: {color};">
|
||||||
<input class="close-button" type="button" value="" on:click={() => noderef.parentNode.removeChild(noderef)}>
|
<span>{message}</span>
|
||||||
</div>
|
<input class="close-button" type="button" value="" on:click={() => visible = false}>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.announcement {
|
.announcement {
|
||||||
@@ -6,7 +6,10 @@
|
|||||||
import '$lib/css/fonts.css';
|
import '$lib/css/fonts.css';
|
||||||
import '$lib/css/colors.css';
|
import '$lib/css/colors.css';
|
||||||
import '$lib/css/anims.css';
|
import '$lib/css/anims.css';
|
||||||
|
|
||||||
|
import Announcement from '$lib/components/announcement.svelte';
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<Announcement message="This is an announcement" color="var(--col_accent)"/>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import Announcement from "../components/announcement.svelte";
|
import Announcement from "../lib/components/announcement.svelte";
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Announcement message="This is an announcement" color="blue"/>
|
|
||||||
|
|
||||||
<h1>Welcome to SvelteKit</h1>
|
<h1>Welcome to SvelteKit</h1>
|
||||||
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> <i>(SvelteKit)</i> to read the <b>SvelteKit</b> documentation</p>
|
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> <i>(SvelteKit)</i> to read the <b>SvelteKit</b> documentation</p>
|
||||||
Reference in New Issue
Block a user