From d916fba0a54ca2ee89f1de1a4dcc0ee71a3a24c5 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Tue, 24 May 2022 19:00:40 +0200
Subject: chore: close search form when launching search

---
 src/components/organisms/toolbar/toolbar.tsx | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'src/components/organisms/toolbar/toolbar.tsx')

diff --git a/src/components/organisms/toolbar/toolbar.tsx b/src/components/organisms/toolbar/toolbar.tsx
index e196c09..ee61a7b 100644
--- a/src/components/organisms/toolbar/toolbar.tsx
+++ b/src/components/organisms/toolbar/toolbar.tsx
@@ -1,4 +1,5 @@
 import useClickOutside from '@utils/hooks/use-click-outside';
+import useRouteChange from '@utils/hooks/use-route-change';
 import { FC, useRef, useState } from 'react';
 import MainNav, { type MainNavProps } from '../toolbar/main-nav';
 import Search, { type SearchProps } from '../toolbar/search';
@@ -42,6 +43,7 @@ const Toolbar: FC<ToolbarProps> = ({
     settingsRef,
     () => isSettingsOpened && setIsSettingsOpened(false)
   );
+  useRouteChange(() => setIsSearchOpened(false));
 
   return (
     <div className={`${styles.wrapper} ${className}`}>
-- 
cgit v1.2.3

