aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/organisms/toolbar/search.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/search.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/search.tsx')
-rw-r--r--src/components/organisms/toolbar/search.tsx19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/components/organisms/toolbar/search.tsx b/src/components/organisms/toolbar/search.tsx
index 90ee1b4..1b2643c 100644
--- a/src/components/organisms/toolbar/search.tsx
+++ b/src/components/organisms/toolbar/search.tsx
@@ -1,12 +1,13 @@
import { forwardRef, ForwardRefRenderFunction, useRef } from 'react';
import { useIntl } from 'react-intl';
-import useInputAutofocus from '../../../utils/hooks/use-input-autofocus';
-import BooleanField, {
+import { useInputAutofocus } from '../../../utils/hooks';
+import {
+ BooleanField,
type BooleanFieldProps,
-} from '../../atoms/forms/boolean-field';
-import MagnifyingGlass from '../../atoms/icons/magnifying-glass';
-import FlippingLabel from '../../molecules/forms/flipping-label';
-import SearchModal, { type SearchModalProps } from '../modals/search-modal';
+ MagnifyingGlass,
+} from '../../atoms';
+import { FlippingLabel } from '../../molecules';
+import { SearchModal, type SearchModalProps } from '../modals';
import searchStyles from './search.module.scss';
import sharedStyles from './toolbar-items.module.scss';
@@ -29,7 +30,7 @@ export type SearchProps = {
setIsActive: BooleanFieldProps['onChange'];
};
-const Search: ForwardRefRenderFunction<HTMLDivElement, SearchProps> = (
+const SearchWithRef: ForwardRefRenderFunction<HTMLDivElement, SearchProps> = (
{ className = '', isActive, searchPage, setIsActive },
ref
) => {
@@ -65,9 +66,9 @@ const Search: ForwardRefRenderFunction<HTMLDivElement, SearchProps> = (
value="open"
/>
<FlippingLabel
+ aria-label={label}
className={sharedStyles.label}
htmlFor="search-button"
- aria-label={label}
isActive={isActive}
>
<MagnifyingGlass aria-hidden={true} />
@@ -81,4 +82,4 @@ const Search: ForwardRefRenderFunction<HTMLDivElement, SearchProps> = (
);
};
-export default forwardRef(Search);
+export const Search = forwardRef(SearchWithRef);