This commit is contained in:
Mary Hipp 2024-01-17 15:13:01 -05:00 committed by psychedelicious
parent 415a1c7a4f
commit c9ddbb4241
4 changed files with 10 additions and 11 deletions

View File

@ -1,13 +1,13 @@
import { Divider, Flex } from '@chakra-ui/layout'; import { Divider, Flex } from '@chakra-ui/layout';
import type { SystemStyleObject } from '@chakra-ui/react'; import type { SystemStyleObject } from '@chakra-ui/react';
import { Collapse, Icon, useDisclosure } from '@chakra-ui/react'; import { Collapse, Icon, useDisclosure } from '@chakra-ui/react';
import { useAppDispatch } from 'app/store/storeHooks';
import type { InvExpanderProps } from 'common/components/InvExpander/types'; import type { InvExpanderProps } from 'common/components/InvExpander/types';
import { InvText } from 'common/components/InvText/wrapper'; import { InvText } from 'common/components/InvText/wrapper';
import { expanderToggled } from 'features/parameters/store/actions';
import { t } from 'i18next'; import { t } from 'i18next';
import { useCallback } from 'react'; import { useCallback } from 'react';
import { BiCollapseVertical, BiExpandVertical } from 'react-icons/bi'; import { BiCollapseVertical, BiExpandVertical } from 'react-icons/bi';
import { useAppDispatch } from '../../../app/store/storeHooks';
import { expanderToggled } from '../../../features/parameters/store/actions';
const buttonStyles: SystemStyleObject = { const buttonStyles: SystemStyleObject = {
color: 'base.400', color: 'base.400',

View File

@ -3,6 +3,5 @@ import type { PropsWithChildren } from 'react';
export type InvExpanderProps = PropsWithChildren<{ export type InvExpanderProps = PropsWithChildren<{
label?: string; label?: string;
defaultIsOpen?: boolean; defaultIsOpen?: boolean;
onClick?: (isOpen: boolean) => void;
id?: string; id?: string;
}>; }>;

View File

@ -1,14 +1,14 @@
import { useAppDispatch } from 'app/store/storeHooks';
import { InvAccordionButton } from 'common/components/InvAccordion/InvAccordionButton'; import { InvAccordionButton } from 'common/components/InvAccordion/InvAccordionButton';
import { import {
InvAccordion, InvAccordion,
InvAccordionItem, InvAccordionItem,
InvAccordionPanel, InvAccordionPanel,
} from 'common/components/InvAccordion/wrapper'; } from 'common/components/InvAccordion/wrapper';
import { singleAccordionExpanded } from 'features/parameters/store/actions';
import { memo, useCallback } from 'react'; import { memo, useCallback } from 'react';
import type { InvSingleAccordionProps } from './types'; import type { InvSingleAccordionProps } from './types';
import { singleAccordionExpanded } from '../../../features/parameters/store/actions';
import { useAppDispatch } from '../../../app/store/storeHooks';
export const InvSingleAccordion = memo((props: InvSingleAccordionProps) => { export const InvSingleAccordion = memo((props: InvSingleAccordionProps) => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
@ -18,7 +18,7 @@ export const InvSingleAccordion = memo((props: InvSingleAccordionProps) => {
dispatch(singleAccordionExpanded({ id: props.id, isOpen })); dispatch(singleAccordionExpanded({ id: props.id, isOpen }));
} }
}, },
[props] [props, dispatch]
); );
return ( return (

View File

@ -9,10 +9,10 @@ export const modelSelected = createAction<MainModelField>(
'generation/modelSelected' 'generation/modelSelected'
); );
export const expanderToggled = createAction<{ id: string, isOpen: boolean }>( export const expanderToggled = createAction<{ id: string; isOpen: boolean }>(
'parameters/expanderToggled' 'parameters/expanderToggled'
); );
export const singleAccordionExpanded = createAction<{ id: string, isOpen: boolean }>( export const singleAccordionExpanded = createAction<{
'parameters/singleAccordionExpanded' id: string;
); isOpen: boolean;
}>('parameters/singleAccordionExpanded');