From fce651a618ca6d0d64fbcea757c3e0f582e1b437 Mon Sep 17 00:00:00 2001
From: lonkaars <l.leblansch@gmail.com>
Date: Thu, 22 Apr 2021 12:35:53 +0200
Subject: beginnings of theme settings

---
 components/ui.tsx | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

(limited to 'components/ui.tsx')

diff --git a/components/ui.tsx b/components/ui.tsx
index 1e9997a..c92ebfe 100644
--- a/components/ui.tsx
+++ b/components/ui.tsx
@@ -122,26 +122,12 @@ export function CheckBox(props: {
 	id?: string;
 	onclick?: (state: boolean) => void;
 }) {
-	var [gotDefaultState, setGotDefaultState] = useState(false);
-	var [on, setOn] = useState(props.state);
-
-	useEffect(() => {
-		if (gotDefaultState) return;
-		setOn(props.state);
-		if (typeof props.state !== 'undefined') setGotDefaultState(true);
-	});
-
-	var toggle = () => {
-		setOn(!on);
-		props.onclick && props.onclick(!on);
-	};
-
 	return <div
-		onClick={toggle}
+        onClick={() => props.onclick && props.onclick(!props.state)}
 		id={props.id}
-		className={'checkbox dispinbl ' + (on ? 'on' : 'off')}
+		className={'checkbox dispinbl ' + (props.state ? 'on' : 'off')}
 	>
-		{on
+		{props.state
 			? <CheckBoxIcon />
 			: <CheckBoxOutlineBlankIcon />}
 	</div>;
-- 
cgit v1.2.3

