fix: fix errors and reformat code

This commit is contained in:
saicaca
2024-08-03 16:40:20 +08:00
parent 1f93499ece
commit 0ad144add3
44 changed files with 550 additions and 558 deletions

View File

@@ -1,4 +1,9 @@
import {AUTO_MODE, DARK_MODE, DEFAULT_THEME, LIGHT_MODE} from "@constants/constants.ts";
import {
AUTO_MODE,
DARK_MODE,
DEFAULT_THEME,
LIGHT_MODE,
} from '@constants/constants.ts'
import type { LIGHT_DARK_MODE } from '@/types/config'
export function getDefaultHue(): number {
@@ -21,7 +26,6 @@ export function setHue(hue: number): void {
r.style.setProperty('--hue', String(hue))
}
export function applyThemeToDocument(theme: LIGHT_DARK_MODE) {
switch (theme) {
case LIGHT_MODE:
@@ -46,5 +50,5 @@ export function setTheme(theme: LIGHT_DARK_MODE): void {
}
export function getStoredTheme(): LIGHT_DARK_MODE {
return localStorage.getItem('theme') as LIGHT_DARK_MODE || DEFAULT_THEME
return (localStorage.getItem('theme') as LIGHT_DARK_MODE) || DEFAULT_THEME
}

View File

@@ -9,7 +9,7 @@ export function pathsEqual(path1: string, path2: string) {
function joinUrl(...parts: string[]): string {
const joined = parts.join('/')
return joined.replace(/\/+/g, '/');
return joined.replace(/\/+/g, '/')
}
export function getPostUrlBySlug(slug: string): string {
@@ -32,4 +32,4 @@ export function getDir(path: string): string {
export function url(path: string) {
return joinUrl('', import.meta.env.BASE_URL, path)
}
}