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