From 39231032ef9abfc3a90af7bf0460037aa220ce11 Mon Sep 17 00:00:00 2001
From: Kristóf Marussy <kristof@marussy.com>
Date: Wed, 16 Feb 2022 01:09:27 +0100
Subject: feat: Basic location bar
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Still needs adding event handlers to actually navigate the browser.

Signed-off-by: Kristóf Marussy <kristof@marussy.com>
---
 .../components/sidebar/ToggleDarkModeButton.tsx    | 43 ++++++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 packages/renderer/src/components/sidebar/ToggleDarkModeButton.tsx

(limited to 'packages/renderer/src/components/sidebar/ToggleDarkModeButton.tsx')

diff --git a/packages/renderer/src/components/sidebar/ToggleDarkModeButton.tsx b/packages/renderer/src/components/sidebar/ToggleDarkModeButton.tsx
new file mode 100644
index 0000000..164b066
--- /dev/null
+++ b/packages/renderer/src/components/sidebar/ToggleDarkModeButton.tsx
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C)  2021-2022 Kristóf Marussy <kristof@marussy.com>
+ *
+ * This file is part of Sophie.
+ *
+ * Sophie is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
+import DarkModeIcon from '@mui/icons-material/DarkMode';
+import LightModeIcon from '@mui/icons-material/LightMode';
+import IconButton from '@mui/material/IconButton';
+import { observer } from 'mobx-react-lite';
+import React from 'react';
+
+import { useStore } from '../StoreProvider';
+
+export default observer(() => {
+  const store = useStore();
+  const {
+    shared: { shouldUseDarkColors },
+  } = store;
+
+  return (
+    <IconButton
+      aria-label="Toggle dark mode"
+      onClick={() => store.toggleDarkMode()}
+    >
+      {shouldUseDarkColors ? <LightModeIcon /> : <DarkModeIcon />}
+    </IconButton>
+  );
+});
-- 
cgit v1.2.3-54-g00ecf

