aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/organisms/toolbar/toolbar.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-09-20 16:38:54 +0200
committerArmand Philippot <git@armandphilippot.com>2023-09-20 16:38:54 +0200
commitf861e6a269ba9f62700776d3cd13b644a9e836d4 (patch)
treea5a107e7a6e4ff8b4261fe04349357bc00b783ee /src/components/organisms/toolbar/toolbar.tsx
parent03331c44276ec56e9f235e4d5ee75030455a753f (diff)
refactor: use named export for everything except pages
Next expect a default export for pages so only those components should use default exports. Everything else should use named exports to reduce the number of import statements.
Diffstat (limited to 'src/components/organisms/toolbar/toolbar.tsx')
-rw-r--r--src/components/organisms/toolbar/toolbar.tsx25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/components/organisms/toolbar/toolbar.tsx b/src/components/organisms/toolbar/toolbar.tsx
index 339dec4..218b4fb 100644
--- a/src/components/organisms/toolbar/toolbar.tsx
+++ b/src/components/organisms/toolbar/toolbar.tsx
@@ -1,9 +1,8 @@
import { FC, useState } from 'react';
-import useOnClickOutside from '../../../utils/hooks/use-on-click-outside';
-import useRouteChange from '../../../utils/hooks/use-route-change';
-import MainNav, { type MainNavProps } from '../toolbar/main-nav';
-import Search, { type SearchProps } from '../toolbar/search';
-import Settings, { type SettingsProps } from '../toolbar/settings';
+import { useOnClickOutside, useRouteChange } from '../../../utils/hooks';
+import { MainNav, type MainNavProps } from './main-nav';
+import { Search, type SearchProps } from './search';
+import { Settings, type SettingsProps } from './settings';
import styles from './toolbar.module.scss';
export type ToolbarProps = Pick<SearchProps, 'searchPage'> &
@@ -23,7 +22,7 @@ export type ToolbarProps = Pick<SearchProps, 'searchPage'> &
*
* Render the website toolbar.
*/
-const Toolbar: FC<ToolbarProps> = ({
+export const Toolbar: FC<ToolbarProps> = ({
ackeeStorageKey,
className = '',
motionStorageKey,
@@ -49,18 +48,18 @@ const Toolbar: FC<ToolbarProps> = ({
return (
<div className={`${styles.wrapper} ${className}`}>
<MainNav
- items={nav}
- isActive={isNavOpened}
- setIsActive={() => setIsNavOpened(!isNavOpened)}
className={styles.modal}
+ isActive={isNavOpened}
+ items={nav}
ref={mainNavRef}
+ setIsActive={() => setIsNavOpened(!isNavOpened)}
/>
<Search
- searchPage={searchPage}
- isActive={isSearchOpened}
- setIsActive={() => setIsSearchOpened(!isSearchOpened)}
className={`${styles.modal} ${styles['modal--search']}`}
+ isActive={isSearchOpened}
ref={searchRef}
+ searchPage={searchPage}
+ setIsActive={() => setIsSearchOpened(!isSearchOpened)}
/>
<Settings
ackeeStorageKey={ackeeStorageKey}
@@ -74,5 +73,3 @@ const Toolbar: FC<ToolbarProps> = ({
</div>
);
};
-
-export default Toolbar;