Format files

This commit is contained in:
Santiago Lo Coco 2024-04-23 17:15:55 +02:00
parent 2eb6a9c0ba
commit ccc7a897d5
5 changed files with 40 additions and 47 deletions

View File

@ -1,35 +1,35 @@
<script lang="ts" context="module"> <script lang="ts" context="module">
export const themes = ["light", "dark"] as const export const themes = ["light", "dark"] as const
export type Theme = (typeof themes)[number] export type Theme = (typeof themes)[number]
</script> </script>
<script lang="ts"> <script lang="ts">
import { slide } from "svelte/transition" import { slide } from "svelte/transition"
let { theme } = $props<{ theme: Theme }>() let { theme } = $props<{ theme: Theme }>()
function toggleTheme() { function toggleTheme() {
const currentIndex = themes.indexOf(theme) const currentIndex = themes.indexOf(theme)
theme = themes[(currentIndex + 1) % themes.length] theme = themes[(currentIndex + 1) % themes.length]
} }
let icon = $derived.by(() => { let icon = $derived.by(() => {
if (theme === "light") return "🌞" if (theme === "light") return "🌞"
if (theme === "dark") return "🌙" if (theme === "dark") return "🌙"
}) })
</script> </script>
{#key theme} {#key theme}
<button transition:slide={{ axis: "x" }} onclick={toggleTheme}> <button transition:slide={{ axis: "x" }} onclick={toggleTheme}>
{icon} {icon}
</button> </button>
{/key} {/key}
<slot /> <slot />
<style lang="postcss"> <style lang="postcss">
button { button {
@apply absolute top-0 right-0; @apply absolute top-0 right-0;
@apply text-3xl; @apply text-3xl;
@apply cursor-pointer; @apply cursor-pointer;
} }
</style> </style>

View File

@ -24,4 +24,3 @@
@apply bg-background text-foreground; @apply bg-background text-foreground;
} }
</style> </style>

View File

@ -4,7 +4,7 @@
</main> </main>
<style lang="postcss"> <style lang="postcss">
main { main {
@apply text-center; @apply text-center;
@apply mx-auto my-64; @apply mx-auto my-64;
} }

View File

@ -135,9 +135,7 @@
<main> <main>
<div> <div>
<h1> <h1>Prevent CVS</h1>
Prevent CVS
</h1>
{#if $state !== "Ready"} {#if $state !== "Ready"}
<p>{$state}</p> <p>{$state}</p>
<p>Time left until end of break: {$timeLeftDisplay}</p> <p>Time left until end of break: {$timeLeftDisplay}</p>
@ -145,14 +143,11 @@
<p>Time left until break: {$timeLeftDisplay}</p> <p>Time left until break: {$timeLeftDisplay}</p>
{/if} {/if}
{#if $state !== "Ready"} {#if $state !== "Ready"}
<button <button on:click={skipBreak}>Skip Break</button>
on:click={skipBreak}>Skip Break</button
>
{/if} {/if}
</div> </div>
</main> </main>
<style lang="postcss"> <style lang="postcss">
main { main {
@apply text-center; @apply text-center;

View File

@ -3,7 +3,6 @@ import { vitePreprocess } from "@sveltejs/vite-plugin-svelte"
/** @type {import('@sveltejs/kit').Config} */ /** @type {import('@sveltejs/kit').Config} */
const config = { const config = {
// vitePlugin: { // vitePlugin: {
// dynamicCompileOptions({filename}){ // dynamicCompileOptions({filename}){
// if(filename.includes('node_modules')){ // if(filename.includes('node_modules')){
@ -13,8 +12,8 @@ const config = {
// }, // },
// compilerOptions: { // compilerOptions: {
// runes: true // runes: true
// }, // },
// Consult https://kit.svelte.dev/docs/integrations#preprocessors // Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors // for more information about preprocessors