feat: Dark/Light mode switcher
This commit is contained in:
parent
422682125c
commit
da933c04d7
@ -39,11 +39,12 @@
|
|||||||
"vite": "^6.0.0"
|
"vite": "^6.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lucide-svelte": "^0.474.0",
|
|
||||||
"socket.io": "^4.8.1",
|
|
||||||
"@types/express": "^5.0.0",
|
"@types/express": "^5.0.0",
|
||||||
"cassandra-driver": "^4.7.2",
|
"cassandra-driver": "^4.7.2",
|
||||||
"express": "^4.21.2",
|
"express": "^4.21.2",
|
||||||
|
"lucide-svelte": "^0.474.0",
|
||||||
|
"mode-watcher": "^0.5.1",
|
||||||
|
"socket.io": "^4.8.1",
|
||||||
"socket.io-client": "^4.8.1",
|
"socket.io-client": "^4.8.1",
|
||||||
"tsm": "^2.3.0",
|
"tsm": "^2.3.0",
|
||||||
"uuid": "^11.0.4"
|
"uuid": "^11.0.4"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import MessagesSquare from 'lucide-svelte/icons/messages-square';
|
import MessagesSquare from 'lucide-svelte/icons/messages-square';
|
||||||
|
import ModeSwitcher from './modeSwitcher.svelte';
|
||||||
import Channel from './channel.svelte';
|
import Channel from './channel.svelte';
|
||||||
import type { Snippet } from 'svelte';
|
import type { Snippet } from 'svelte';
|
||||||
|
|
||||||
@ -19,6 +20,7 @@
|
|||||||
<MessagesSquare class="h-6 w-6" />
|
<MessagesSquare class="h-6 w-6" />
|
||||||
<span class="">SVChat</span>
|
<span class="">SVChat</span>
|
||||||
</a>
|
</a>
|
||||||
|
<ModeSwitcher />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
<nav class="grid items-start px-2 text-sm font-medium lg:px-4">
|
<nav class="grid items-start px-2 text-sm font-medium lg:px-4">
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
const { message, imageSrc, user }: TypeMessage = $props();
|
const { message, imageSrc, user }: TypeMessage = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="w-full hover:bg-base-300 bg-base-200 flex py-2">
|
<div class="w-full hover:bg-gray-200 flex py-2 dark:hover:bg-stone-900">
|
||||||
<div class="avatar mx-2">
|
<div class="avatar mx-2 rounded-sm">
|
||||||
<div class="w-12 h-12 rounded">
|
<div class="w-12 h-12 overflow-hidden rounded-lg border bg-white">
|
||||||
<img src={imageSrc} alt="Profile image for {user}" />
|
<img src={imageSrc} alt="Profile image for {user}" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
12
src/lib/components/modeSwitcher.svelte
Normal file
12
src/lib/components/modeSwitcher.svelte
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import Sun from 'lucide-svelte/icons/sun';
|
||||||
|
import Moon from 'lucide-svelte/icons/moon-star';
|
||||||
|
import { toggleMode } from 'mode-watcher';
|
||||||
|
import { Button } from '$lib/components/ui/button/index';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Button on:click={toggleMode} variant="outline" size="icon" class="ml-auto">
|
||||||
|
<Sun class="h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />
|
||||||
|
<Moon class="absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" />
|
||||||
|
<span class="sr-only">Toggle theme</span>
|
||||||
|
</Button>
|
@ -2,10 +2,12 @@
|
|||||||
import '../app.css';
|
import '../app.css';
|
||||||
import type { LayoutProps } from './$types';
|
import type { LayoutProps } from './$types';
|
||||||
import MainLayout from '$lib/components/mainLayout.svelte';
|
import MainLayout from '$lib/components/mainLayout.svelte';
|
||||||
|
import { ModeWatcher } from 'mode-watcher';
|
||||||
let { data, children }: LayoutProps = $props();
|
let { data, children }: LayoutProps = $props();
|
||||||
const channels = data.channels;
|
const channels = data.channels;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<ModeWatcher />
|
||||||
<MainLayout {channels}>
|
<MainLayout {channels}>
|
||||||
{@render children()}
|
{@render children()}
|
||||||
</MainLayout>
|
</MainLayout>
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
{/each}
|
{/each}
|
||||||
{/snippet}
|
{/snippet}
|
||||||
<div class="flex flex-1 flex-col items-center justify-center rounded-lg shadow-sm gap-1 h-full">
|
<div class="flex flex-1 flex-col items-center justify-center rounded-lg shadow-sm gap-1 h-full">
|
||||||
<div class="flex-grow flex-col-reverse flex flex-auto overflow-y-scroll overflow-x-hidden rounded-lg border-2 w-full">
|
<div class="flex-grow flex-col-reverse flex flex-auto overflow-y-scroll overflow-x-hidden rounded-lg border w-full">
|
||||||
{@render message(log)}
|
{@render message(log)}
|
||||||
{@render message(data.messages)}
|
{@render message(data.messages)}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user