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>
---
 .../src/components/locationBar/LocationBar.tsx     | 54 ++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 packages/renderer/src/components/locationBar/LocationBar.tsx

(limited to 'packages/renderer/src/components/locationBar/LocationBar.tsx')

diff --git a/packages/renderer/src/components/locationBar/LocationBar.tsx b/packages/renderer/src/components/locationBar/LocationBar.tsx
new file mode 100644
index 0000000..e1f470d
--- /dev/null
+++ b/packages/renderer/src/components/locationBar/LocationBar.tsx
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C)  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 { styled } from '@mui/material/styles';
+import { observer } from 'mobx-react-lite';
+import React from 'react';
+
+import { useStore } from '../StoreProvider';
+
+import LocationTextField from './LocationTextField';
+import NavigationButtons from './NavigationButtons';
+
+const LocationBarRoot = styled('header', {
+  name: 'LocationBar',
+  slot: 'Root',
+})(({ theme, hidden }) => ({
+  display: hidden ? 'none' : 'flex',
+  flexDirection: 'row',
+  padding: theme.spacing(1),
+  gap: theme.spacing(1),
+  borderBottom: `1px solid ${theme.palette.divider}`,
+}));
+
+function LocationBar(): JSX.Element {
+  const {
+    settings: { selectedService, showLocationBar },
+  } = useStore();
+
+  return (
+    <LocationBarRoot id="locationBar" hidden={!showLocationBar}>
+      <NavigationButtons service={selectedService} />
+      <LocationTextField service={selectedService} />
+    </LocationBarRoot>
+  );
+}
+
+export default observer(LocationBar);
-- 
cgit v1.2.3-54-g00ecf

