Skip to content

Commit

Permalink
Merge pull request #1059 from rainlanguage/1058-move-buttondarkmodesv…
Browse files Browse the repository at this point in the history
…elte-component-in-ui-components

Move ButtonDarkMode component into ui-components
  • Loading branch information
hardyjosh authored Dec 11, 2024
2 parents 73effae + 3b7ce7d commit 94bb389
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
15 changes: 15 additions & 0 deletions packages/ui-components/src/lib/components/ButtonDarkMode.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<script lang="ts">
import { DarkMode } from 'flowbite-svelte';
import { writable } from 'svelte/store';
export let colorTheme = writable();
function toggle(e: MouseEvent) {
const isDark = (e.target as HTMLElement).ownerDocument.documentElement.classList.contains(
'dark'
);
colorTheme.set(isDark ? 'dark' : 'light');
}
</script>

<button type="button" on:click={toggle}>
<DarkMode />
</button>
15 changes: 0 additions & 15 deletions tauri-app/src/lib/components/ButtonDarkMode.svelte

This file was deleted.

5 changes: 3 additions & 2 deletions tauri-app/src/lib/components/Sidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
import FileLinesSolid from 'flowbite-svelte-icons/FileLinesSolid.svelte';
import IconExternalLink from '$lib/components/IconExternalLink.svelte';
import { page } from '$app/stores';
import ButtonDarkMode from '$lib/components/ButtonDarkMode.svelte';
import ButtonDarkMode from '../../../../packages/ui-components/src/lib/components/ButtonDarkMode.svelte';
import { PlusSolid } from 'flowbite-svelte-icons';
import IconTelegram from '$lib/components/IconTelegram.svelte';
import ModalConnect from '$lib/components/ModalConnect.svelte';
import { onMount } from 'svelte';
import { getAppCommitSha } from '$lib/services/app';
import { colorTheme } from '$lib/stores/darkMode';
let app_sha: string;
onMount(async () => {
Expand Down Expand Up @@ -107,7 +108,7 @@
</SidebarItem>
</SidebarGroup>
<SidebarGroup border class="flex justify-start">
<ButtonDarkMode />
<ButtonDarkMode {colorTheme} />
</SidebarGroup>
<SidebarGroup border class="flex justify-start self-end">
<div class="flex flex-col text-xs text-gray-500 dark:text-gray-400">
Expand Down

0 comments on commit 94bb389

Please sign in to comment.