blackbirdchess-client-web/src/routes/+layout.svelte

47 lines
1.5 KiB
Svelte
Raw Normal View History

2023-03-18 18:07:38 +01:00
<script lang="ts">
2023-08-17 00:22:44 +02:00
// The ordering of these imports is critical to your app working properly
import '@skeletonlabs/skeleton/themes/theme-skeleton.css';
// If you have source.organizeImports set to true in VSCode, then it will auto change this ordering
import '@skeletonlabs/skeleton/styles/all.css';
2023-08-17 01:01:32 +02:00
import '$lib/scss/icons.scss'
2023-08-17 00:22:44 +02:00
// Most of your app wide CSS should be put in this file
import '../app.postcss';
2023-08-16 20:42:54 +02:00
import {alerts, globals} from "$lib/stores.js";
2023-08-17 00:22:55 +02:00
import { autoModeWatcher } from '@skeletonlabs/skeleton';
2023-08-16 20:42:54 +02:00
let alertsvar;
let globalvars;
function closeWarning(e) {
let index = e.target.dataset.index;
alerts.update(function (data) {
data.splice(index, 1)
return data;
})
}
alerts.subscribe((value) => {
alertsvar = value;
});
globals.subscribe(value => {
globalvars = value;
});
2023-03-18 18:07:38 +01:00
</script>
2023-08-17 00:22:55 +02:00
<svelte:head>{@html `<script>${autoModeWatcher.toString()} autoModeWatcher();</script>`}</svelte:head>
2023-08-16 20:42:54 +02:00
{#if typeof globalvars.user !== 'undefined' }
{#each alertsvar as alert, i}
<aside class="alert variant-filled-{alert.class}">
<!-- Icon -->
<div><i class="text-2xl icon icon-exclamation-triangle"></i></div>
<!-- Message -->
<p class="alert-message">{alert.text}</p>
<!-- Actions -->
<div class="alert-actions">
<i on:click={closeWarning} data-index={i} class="icon icon-close"></i>
</div>
</aside>
{/each}
{/if}
2023-03-18 18:07:38 +01:00
<slot />