From f9df5cbce7db38ce83cc8b40346c9cabde5debc4 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Mon, 20 Dec 2021 19:03:17 +0100
Subject: chore: add a button to open/close search in toolbar

---
 src/components/Toolbar/Toolbar.tsx | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

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

diff --git a/src/components/Toolbar/Toolbar.tsx b/src/components/Toolbar/Toolbar.tsx
index b7acce9..6be2029 100644
--- a/src/components/Toolbar/Toolbar.tsx
+++ b/src/components/Toolbar/Toolbar.tsx
@@ -1,10 +1,27 @@
+import { ButtonSearch } from '@components/Buttons';
 import MainNav from '@components/MainNav/MainNav';
+import { useEffect, useState } from 'react';
 import styles from './Toolbar.module.scss';
 
 const Toolbar = () => {
+  const [isNavOpened, setIsNavOpened] = useState<boolean>(false);
+  const [isSearchOpened, setIsSearchOpened] = useState<boolean>(false);
+
+  useEffect(() => {
+    if (isNavOpened) setIsSearchOpened(false);
+  }, [isNavOpened]);
+
+  useEffect(() => {
+    if (isSearchOpened) setIsNavOpened(false);
+  }, [isSearchOpened]);
+
   return (
     <div className={styles.wrapper}>
-      <MainNav />
+      <MainNav isOpened={isNavOpened} setIsOpened={setIsNavOpened} />
+      <ButtonSearch
+        isActivated={isSearchOpened}
+        setIsActivated={setIsSearchOpened}
+      />
     </div>
   );
 };
-- 
cgit v1.2.3

