From 04497e65f8428847b0381263b53e44fa82bbb3f5 Mon Sep 17 00:00:00 2001 From: StarHeartHunt Date: Fri, 21 Jun 2024 12:06:05 +0800 Subject: [PATCH] refactor: move to preact --- astro.config.ts | 2 +- src/components/ThemeSwitcher.tsx | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/astro.config.ts b/astro.config.ts index 0b6e5e9..16f341c 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -104,7 +104,7 @@ export default defineConfig({ mdx(), sitemap(), tailwind(), - preact({ compat: true }), + preact(), compress({ CSS: true, HTML: true, diff --git a/src/components/ThemeSwitcher.tsx b/src/components/ThemeSwitcher.tsx index b528ffb..777e042 100644 --- a/src/components/ThemeSwitcher.tsx +++ b/src/components/ThemeSwitcher.tsx @@ -1,11 +1,12 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ -import { useEffect, useState, type ReactElement } from "react"; +import { type Component } from "preact"; +import { useEffect, useState } from "preact/hooks"; type Props = { - dayIcon?: ReactElement; - nightIcon?: ReactElement; + dayIcon?: Component; + nightIcon?: Component; }; export default function ThemeSwitcher({ dayIcon, nightIcon }: Props) { @@ -75,7 +76,7 @@ export default function ThemeSwitcher({ dayIcon, nightIcon }: Props) { } return ( -
toggleDark(e.nativeEvent)}> +
{dayIcon} {nightIcon}