CHORE: Starting to get to work with changing some of the old formatting over to tailwind config

This commit is contained in:
2025-05-21 22:45:18 +01:00
parent fc642a4ecd
commit 24a7ebf02a
28 changed files with 118 additions and 734 deletions

View File

@@ -1,95 +0,0 @@
<script lang="ts">
import { browser } from '$app/environment';
export let darkMode: boolean = true;
function onThemeSwitch() {
darkMode = !darkMode;
localStorage.setItem('theme', darkMode ? 'dark' : 'light');
darkMode
? document.documentElement.classList.add('dark')
: document.documentElement.classList.remove('dark');
}
if (browser) {
if (
localStorage.theme === 'dark' ||
(!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)
) {
document.documentElement.classList.add('dark');
darkMode = true;
} else {
document.documentElement.classList.remove('dark');
darkMode = false;
}
}
</script>
<style>
input {
display: none;
}
.switch {
position: absolute;
top: 0em;
right: 0em;
display: inline-block;
width: 3.75em;
height: 2.125em;
}
.slider {
position: absolute;
cursor: pointer;
background-color: var(--accent);
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: var(--accent);
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 80%;
width: 45%;
left: 4px;
bottom: 4px;
background-color: var(--bg);
-webkit-transition: .4s;
transition: .4s;
}
input:checked + .slider:before {
-webkit-transform: translateX(1.625em);
-ms-transform: translateX(1.625em);
transform: translateX(1.625em);
}
.slider.round {
border-radius: 2.125em;
}
.slider.round:before {
border-radius: 50%;
}
</style>
<svelte:head>
<link rel="stylesheet" href={`/themes/${darkMode ? 'dark' : 'light'}.css`} />
</svelte:head>
<div class="toggle-wrapper not-required">
<label class="switch">
<input type="checkbox" checked={darkMode} on:click={onThemeSwitch}>
<span class="slider round"></span>
</label>
</div>

View File

@@ -1,18 +0,0 @@
<script>
export let width = "1em"
</script>
<svg
width={width}
style="text-align: center; display: inline-block;"
aria-hidden="true"
focusable="false"
role="img"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 352 512"
>
<path
fill="currentColor"
d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"
/>
</svg>

View File

@@ -1,19 +0,0 @@
<script>
export let width = "1em"
</script>
<svg
width={width}
style="text-align: center; display: inline-block;"
aria-hidden="true"
focusable="false"
role="img"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 512 512"
>
<path
fill="currentColor"
d="M256 40c118.621 0 216 96.075 216 216 0 119.291-96.61 216-216 216-119.244 0-216-96.562-216-216 0-119.203 96.602-216 216-216m0-32C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm-11.49 120h22.979c6.823 0 12.274 5.682 11.99 12.5l-7 168c-.268 6.428-5.556 11.5-11.99 11.5h-8.979c-6.433 0-11.722-5.073-11.99-11.5l-7-168c-.283-6.818 5.167-12.5 11.99-12.5zM256 340c-15.464 0-28 12.536-28 28s12.536 28 28 28 28-12.536 28-28-12.536-28-28-28z"
class=""
></path>
</svg>

View File

@@ -1,18 +0,0 @@
<script>
export let width = "1em"
</script>
<svg
width={width}
style="text-align: center; display: inline-block;"
aria-hidden="true"
focusable="false"
role="img"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 512 512"
>
<path
fill="currentColor"
d="M256 40c118.621 0 216 96.075 216 216 0 119.291-96.61 216-216 216-119.244 0-216-96.562-216-216 0-119.203 96.602-216 216-216m0-32C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm-36 344h12V232h-12c-6.627 0-12-5.373-12-12v-8c0-6.627 5.373-12 12-12h48c6.627 0 12 5.373 12 12v140h12c6.627 0 12 5.373 12 12v8c0 6.627-5.373 12-12 12h-72c-6.627 0-12-5.373-12-12v-8c0-6.627 5.373-12 12-12zm36-240c-17.673 0-32 14.327-32 32s14.327 32 32 32 32-14.327 32-32-14.327-32-32-32z"
/>
</svg>

View File

@@ -1,18 +0,0 @@
<script>
export let width = "1em"
</script>
<svg
width={width}
style="text-align: center; display: inline-block;"
aria-hidden="true"
focusable="false"
role="img"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 512 512"
>
<path
fill="currentColor"
d="M256 8C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 464c-118.664 0-216-96.055-216-216 0-118.663 96.055-216 216-216 118.664 0 216 96.055 216 216 0 118.663-96.055 216-216 216zm141.63-274.961L217.15 376.071c-4.705 4.667-12.303 4.637-16.97-.068l-85.878-86.572c-4.667-4.705-4.637-12.303.068-16.97l8.52-8.451c4.705-4.667 12.303-4.637 16.97.068l68.976 69.533 163.441-162.13c4.705-4.667 12.303-4.637 16.97.068l8.451 8.52c4.668 4.705 4.637 12.303-.068 16.97z"
/>
</svg>

View File

@@ -1,67 +0,0 @@
<script lang="ts">
import { createEventDispatcher } from "svelte";
import { fade } from "svelte/transition";
import { Toast, ToastType } from "$lib/toast";
import SuccessIcon from "./SuccessIcon.svelte";
import ErrorIcon from "./ErrorIcon.svelte";
import InfoIcon from "./InfoIcon.svelte";
import CloseIcon from "./CloseIcon.svelte";
const dispatch = createEventDispatcher();
export let toastData: Toast;
</script>
<article class={toastData.type.toString().toLowerCase()} role="alert" transition:fade>
{#if toastData.type === ToastType.Success}
<SuccessIcon width="1.1em" />
{:else if toastData.type === ToastType.Error}
<ErrorIcon width="1.1em" />
{:else}
<InfoIcon width="1.1em" />
{/if}
<div class="text">
{toastData.text}
</div>
{#if toastData.dismissable}
<button class="close" on:click={() => dispatch("dismiss")}>
<CloseIcon width="0.8em" />
</button>
{/if}
</article>
<style lang="postcss">
article {
color: white;
padding: 0.75rem 1.5rem;
border-radius: 0.2rem;
display: flex;
align-items: center;
margin: 0 auto 0.5rem auto;
width: 20rem;
max-width: 80%;
}
.error {
background: var(--red);
}
.success {
background: var(--green);
}
.info {
background: var(--blue);
}
.text {
margin-left: 1rem;
}
.close {
color: white;
background: transparent;
border: 0 none;
padding: 0;
margin: 0 0 0 auto;
line-height: 1;
font-size: 1rem;
}
</style>

View File

@@ -1,28 +0,0 @@
<script lang="ts">
import Toast from "./Toast.svelte";
import { dismissToast, toasts } from "$lib/stores";
</script>
{#if $toasts}
<section>
{#each $toasts as toast (toast.id)}
<Toast toastData = {toast} on:dismiss={() => dismissToast(toast.id)} />
{/each}
</section>
{/if}
<style lang="postcss">
section {
position: fixed;
bottom: 0;
left: 0;
right: 0;
width: 100%;
display: flex;
margin-top: 1rem;
justify-content: center;
flex-direction: column;
z-index: 10;
}
</style>

View File

@@ -1,8 +1,8 @@
<script lang="ts">
import { setContext } from 'svelte';
import type { TimelinePosition, TimelineConfig } from '../types';
import type { TimelinePosition, TimelineConfig } from '$lib/types';
export let position: TimelinePosition = 'right';
export let style: string = null;
export let style: string | null = null;
setContext<TimelineConfig>('TimelineConfig', { rootPosition: position });
</script>

View File

@@ -1,7 +1,7 @@
<script lang="ts">
import { getContext } from 'svelte';
import type { TimelineConfig, TimelinePosition } from '../types';
export let style: string = null;
import type { TimelineConfig, TimelinePosition } from '$lib/types';
export let style: string | null = null;
const config = getContext<TimelineConfig>('TimelineConfig');
const parentPosition = getContext<TimelinePosition>('ParentPosition');

View File

@@ -1,5 +1,5 @@
<script lang="ts">
export let style: string = null;
export let style: string | null = null;
</script>
<span class="timeline-dot" {style}>

View File

@@ -1,7 +1,7 @@
<script lang="ts">
import { getContext } from 'svelte';
import type { TimelineConfig, TimelinePosition } from '../types';
export let style: string = null;
import type { TimelineConfig, TimelinePosition } from '$lib/types';
export let style: string | null = null;
const config = getContext<TimelineConfig>('TimelineConfig');
const parentPosition = getContext<TimelinePosition>('ParentPosition');

View File

@@ -1,5 +1,5 @@
<script lang="ts">
export let style: string = null;
export let style: string | null = null;
</script>
<div class="timeline-separator" {style}>