diff options
| author | Armand Philippot <git@armandphilippot.com> | 2021-12-20 19:03:17 +0100 | 
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2021-12-20 19:05:02 +0100 | 
| commit | f9df5cbce7db38ce83cc8b40346c9cabde5debc4 (patch) | |
| tree | a05ae5a5ef477f3554385a1bec78f625a6ed768c /src/components/Toolbar | |
| parent | f7b08ee862e62b9f8764303f1fef733f210a7138 (diff) | |
chore: add a button to open/close search in toolbar
Diffstat (limited to 'src/components/Toolbar')
| -rw-r--r-- | src/components/Toolbar/Toolbar.tsx | 19 | 
1 files changed, 18 insertions, 1 deletions
| 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>    );  }; | 
