From 395571bd89498fce46d37f3853cf718387fd0d9a Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Mon, 27 Dec 2021 11:20:26 +0100
Subject: chore: add a theme toggle

Dark theme is not implemented yet.
---
 src/components/ThemeToggle/ThemeToggle.tsx | 34 ++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 src/components/ThemeToggle/ThemeToggle.tsx

(limited to 'src/components/ThemeToggle/ThemeToggle.tsx')

diff --git a/src/components/ThemeToggle/ThemeToggle.tsx b/src/components/ThemeToggle/ThemeToggle.tsx
new file mode 100644
index 0000000..015201b
--- /dev/null
+++ b/src/components/ThemeToggle/ThemeToggle.tsx
@@ -0,0 +1,34 @@
+import { Form } from '@components/Form';
+import { MoonIcon, SunIcon } from '@components/Icons';
+import { t } from '@lingui/macro';
+import { FormEvent, useState } from 'react';
+import styles from './ThemeToggle.module.scss';
+
+const ThemeToggle = () => {
+  const [isDarkTheme, setIsDarkTheme] = useState<boolean>(false);
+
+  const onSubmit = (e: FormEvent) => {
+    e.preventDefault();
+  };
+
+  return (
+    <Form modifier="theme" submitHandler={onSubmit}>
+      <input
+        className={styles.checkbox}
+        type="checkbox"
+        id="dark-theme"
+        name="dark-theme"
+        checked={isDarkTheme}
+        onChange={() => setIsDarkTheme(!isDarkTheme)}
+      />
+      <label htmlFor="dark-theme" className={styles.label}>
+        <span className="screen-reader-text">{t`Activate dark theme`}</span>
+        <SunIcon />
+        <span className={styles.toggle}></span>
+        <MoonIcon />
+      </label>
+    </Form>
+  );
+};
+
+export default ThemeToggle;
-- 
cgit v1.2.3

