Skip to content

Commit 3251733

Browse files
Merge pull request #138 from TigerAppsOrg/theme-panel
Theme panel
2 parents f91822b + 7ff6ddb commit 3251733

File tree

11 files changed

+459
-149
lines changed

11 files changed

+459
-149
lines changed

apps/web/src/lib/components/general/AppHeader.svelte

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script lang="ts">
22
import { goto } from "$app/navigation";
33
import { modalStore } from "$lib/stores/modal";
4+
import { panelStore } from "$lib/stores/panel";
45
import { darkTheme, getStyles, isMobile } from "$lib/stores/styles";
56
import type { SupabaseClient } from "@supabase/supabase-js";
67
import { getContext } from "svelte";
@@ -13,6 +14,17 @@
1314
};
1415
1516
$: cssVarStyles = getStyles("0");
17+
18+
// Spinning animation state for theme toggle
19+
let spinning = false;
20+
21+
const toggleTheme = () => {
22+
spinning = true;
23+
darkTheme.set(!$darkTheme);
24+
setTimeout(() => {
25+
spinning = false;
26+
}, 500);
27+
};
1628
</script>
1729

1830
<nav
@@ -31,17 +43,15 @@ dark:border-zinc-700 border-zinc-200"
3143
</div>
3244

3345
<div id="right" class="sm:space-x-6 space-x-4 flex items-center">
34-
<button
35-
on:click={() => ($darkTheme = !$darkTheme)}
36-
class="btn-circ">
46+
<button on:click={toggleTheme} class="btn-circ">
3747
{#if $darkTheme}
3848
<svg
3949
xmlns="http://www.w3.org/2000/svg"
4050
fill="none"
4151
viewBox="0 0 24 24"
4252
stroke-width="1.5"
4353
stroke="currentColor"
44-
class="btn-icon">
54+
class="btn-icon {spinning ? 'spin' : ''}">
4555
<path
4656
stroke-linecap="round"
4757
stroke-linejoin="round"
@@ -54,7 +64,7 @@ dark:border-zinc-700 border-zinc-200"
5464
viewBox="0 0 24 24"
5565
stroke-width="1.5"
5666
stroke="currentColor"
57-
class="btn-icon">
67+
class="btn-icon {spinning ? 'spin' : ''}">
5868
<path
5969
stroke-linecap="round"
6070
stroke-linejoin="round"
@@ -63,7 +73,7 @@ dark:border-zinc-700 border-zinc-200"
6373
{/if}
6474
</button>
6575

66-
<button class="btn-circ" on:click={() => modalStore.push("theme")}>
76+
<button class="btn-circ" on:click={() => panelStore.open("theme")}>
6777
<svg
6878
xmlns="http://www.w3.org/2000/svg"
6979
fill="none"
@@ -135,4 +145,17 @@ dark:border-zinc-700 border-zinc-200"
135145
.btn-icon {
136146
@apply w-5 h-5;
137147
}
148+
149+
.spin {
150+
animation: spin 0.5s ease-in-out;
151+
}
152+
153+
@keyframes spin {
154+
from {
155+
transform: rotate(0deg);
156+
}
157+
to {
158+
transform: rotate(360deg);
159+
}
160+
}
138161
</style>

apps/web/src/lib/components/general/ModalLib.svelte

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
import Feedback from "./Feedback.svelte";
1111
import FeedbackPop from "./FeedbackPop.svelte";
1212
13-
// Style Modals
14-
import Theme from "./style/Theme.svelte";
15-
import Palettes from "./style/Palettes.svelte";
16-
1713
// Event Modals
1814
import ManageEvents from "../recal/modals/events/ManageEvents.svelte";
1915
import EditEvent from "../recal/modals/events/EditEvent.svelte";
@@ -28,8 +24,6 @@
2824
rstats: RecalStats,
2925
feedback: Feedback,
3026
feedbackpop: FeedbackPop,
31-
theme: Theme,
32-
palettes: Palettes,
3327
manageEvents: ManageEvents,
3428
editEvent: EditEvent,
3529
deleteEvent: DeleteEvent

apps/web/src/lib/components/general/style/Palettes.svelte

Lines changed: 0 additions & 24 deletions
This file was deleted.

apps/web/src/lib/components/general/style/Theme.svelte

Lines changed: 0 additions & 101 deletions
This file was deleted.

0 commit comments

Comments
 (0)