From a6ff5eee45215effb3344cb5d631a27a7c0369aa Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Fri, 22 Sep 2023 19:34:01 +0200 Subject: refactor(components): rewrite form components --- src/components/organisms/toolbar/main-nav.stories.tsx | 2 +- src/components/organisms/toolbar/main-nav.tsx | 6 +++--- src/components/organisms/toolbar/search.stories.tsx | 2 +- src/components/organisms/toolbar/search.tsx | 6 +++--- src/components/organisms/toolbar/settings.stories.tsx | 2 +- src/components/organisms/toolbar/settings.tsx | 19 ++++++++----------- src/components/organisms/toolbar/toolbar.tsx | 1 - 7 files changed, 17 insertions(+), 21 deletions(-) (limited to 'src/components/organisms/toolbar') diff --git a/src/components/organisms/toolbar/main-nav.stories.tsx b/src/components/organisms/toolbar/main-nav.stories.tsx index 1ef10b5..57485d3 100644 --- a/src/components/organisms/toolbar/main-nav.stories.tsx +++ b/src/components/organisms/toolbar/main-nav.stories.tsx @@ -57,7 +57,7 @@ export default { } as ComponentMeta; const Template: ComponentStory = ({ - isActive, + isActive = false, setIsActive: _setIsActive, ...args }) => { diff --git a/src/components/organisms/toolbar/main-nav.tsx b/src/components/organisms/toolbar/main-nav.tsx index cf49bd4..4182b4c 100644 --- a/src/components/organisms/toolbar/main-nav.tsx +++ b/src/components/organisms/toolbar/main-nav.tsx @@ -18,7 +18,7 @@ export type MainNavProps = { /** * The button state. */ - isActive: BooleanFieldProps['checked']; + isActive: BooleanFieldProps['isChecked']; /** * The main nav items. */ @@ -30,7 +30,7 @@ export type MainNavProps = { }; const MainNavWithRef: ForwardRefRenderFunction = ( - { className = '', isActive, items, setIsActive }, + { className = '', isActive = false, items, setIsActive }, ref ) => { const intl = useIntl(); @@ -49,9 +49,9 @@ const MainNavWithRef: ForwardRefRenderFunction = ( return (
; const Template: ComponentStory = ({ - isActive, + isActive = false, setIsActive: _setIsActive, ...args }) => { diff --git a/src/components/organisms/toolbar/search.tsx b/src/components/organisms/toolbar/search.tsx index 1b2643c..b20f0d5 100644 --- a/src/components/organisms/toolbar/search.tsx +++ b/src/components/organisms/toolbar/search.tsx @@ -19,7 +19,7 @@ export type SearchProps = { /** * The button state. */ - isActive: BooleanFieldProps['checked']; + isActive: BooleanFieldProps['isChecked']; /** * A callback function to execute search. */ @@ -31,7 +31,7 @@ export type SearchProps = { }; const SearchWithRef: ForwardRefRenderFunction = ( - { className = '', isActive, searchPage, setIsActive }, + { className = '', isActive = false, searchPage, setIsActive }, ref ) => { const intl = useIntl(); @@ -57,9 +57,9 @@ const SearchWithRef: ForwardRefRenderFunction = ( return (
; const Template: ComponentStory = ({ - isActive, + isActive = false, setIsActive: _setIsActive, ...args }) => { diff --git a/src/components/organisms/toolbar/settings.tsx b/src/components/organisms/toolbar/settings.tsx index 8a4d4a9..3f328a5 100644 --- a/src/components/organisms/toolbar/settings.tsx +++ b/src/components/organisms/toolbar/settings.tsx @@ -3,14 +3,13 @@ import { useIntl } from 'react-intl'; import { BooleanField, type BooleanFieldProps, Cog } from '../../atoms'; import { FlippingLabel } from '../../molecules'; import { SettingsModal, type SettingsModalProps } from '../modals'; -import settingsStyles from './settings.module.scss'; -import sharedStyles from './toolbar-items.module.scss'; +import styles from './toolbar-items.module.scss'; export type SettingsProps = SettingsModalProps & { /** * The button state. */ - isActive: BooleanFieldProps['checked']; + isActive: BooleanFieldProps['isChecked']; /** * A callback function to handle button state. */ @@ -24,10 +23,9 @@ const SettingsWithRef: ForwardRefRenderFunction< { ackeeStorageKey, className = '', - isActive, + isActive = false, motionStorageKey, setIsActive, - tooltipClassName = '', }, ref ) => { @@ -45,11 +43,11 @@ const SettingsWithRef: ForwardRefRenderFunction< }); return ( -
+
@@ -65,9 +63,8 @@ const SettingsWithRef: ForwardRefRenderFunction<
); diff --git a/src/components/organisms/toolbar/toolbar.tsx b/src/components/organisms/toolbar/toolbar.tsx index 218b4fb..94c9d95 100644 --- a/src/components/organisms/toolbar/toolbar.tsx +++ b/src/components/organisms/toolbar/toolbar.tsx @@ -68,7 +68,6 @@ export const Toolbar: FC = ({ motionStorageKey={motionStorageKey} ref={settingsRef} setIsActive={() => setIsSettingsOpened(!isSettingsOpened)} - tooltipClassName={styles.tooltip} />
); -- cgit v1.2.3