refactor: rename more

This commit is contained in:
madkarmaa 2025-05-04 15:55:08 +02:00
parent 34f734c83f
commit 150f14bedf
No known key found for this signature in database
GPG Key ID: BF5E2EF8F188606D
2 changed files with 10 additions and 7 deletions

View File

@ -3,14 +3,17 @@ import moment from 'moment';
import { events } from './events';
import { seconds } from './time';
export const theme = readable('default', (set) => {
export const event = readable('default', (set) => {
const updateTheme = () => {
const today = moment();
const monthName = today.format('MMMM').toLowerCase();
const day = today.date();
const now = moment();
const today = {
month: now.format('MMMM').toLowerCase(),
date: now.date()
};
Object.entries(events).forEach(([eventName, [month, date]]) => {
if (monthName === month && day === date) set(eventName);
if (today.month === month && today.date === date) set(eventName);
});
};

View File

@ -1,6 +1,6 @@
<script lang="ts">
import type { Snippet } from 'svelte';
import { theme } from '$stores';
import { event } from '$stores';
import Footer from '$components/organisms/Footer.svelte';
import NavBar from '$components/organisms/NavBar.svelte';
@ -10,7 +10,7 @@
let { children }: Props = $props();
$effect(() => {
document.documentElement.setAttribute('data-theme', $theme);
document.documentElement.setAttribute('data-event-name', $event);
});
</script>