feat: rewrite to solidjs

This commit is contained in:
Tholut A 2026-08-21 15:28:21 +07:00
parent 74c6215c27
commit afa2db26e7
21 changed files with 1074 additions and 1835 deletions

28
components/MainToggle.tsx Normal file
View file

@ -0,0 +1,28 @@
import { createSignal, onMount } from "solid-js";
import { featureEnableBlock } from "@/utils/storage";
import "./MainToggle.css";
export const MainToggle = (props) => {
const [isEnabled, setIsEnabled] = createSignal(false);
onMount(async () => {
const getFeatureEnable = await featureEnableBlock.getValue();
setIsEnabled(getFeatureEnable);
});
const toggleOnOff = () => {
setIsEnabled(!isEnabled());
featureEnableBlock.setValue(isEnabled());
};
return (
<div>
<button class="button-toggle" onClick={() => toggleOnOff()}>
<img
src="/icon/128.png"
class={isEnabled() ? "logo logo-on" : "logo"}
alt="let me focus logo"
/>
</button>
<br />
{isEnabled() ? "[on]" : "[off]"}
</div>
);
};