mirror of
https://github.com/revanced/revanced-website.git
synced 2025-05-25 11:02:17 +02:00
refactor: rename more
This commit is contained in:
parent
34f734c83f
commit
150f14bedf
@ -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);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -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>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user