Skip to content

Commit

Permalink
fix: add accordion content type in static props also
Browse files Browse the repository at this point in the history
affects: @medly-components/core
  • Loading branch information
gmukul01 committed Aug 6, 2023
1 parent 8950e04 commit c2f5625
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/components/Accordion/Content/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { WithStyle } from '@medly-components/utils';
import type { FC } from 'react';
import { memo, useContext } from 'react';
import { AccordionContext } from '../AccordionContext';
import { ContentProps } from '../types';
import { Wrapper } from './Content.styled';
import { AccordionContentProps } from './types';

const Component: FC<AccordionContentProps> = memo(props => {
const Component: FC<ContentProps> = memo(props => {
const [isActive] = useContext(AccordionContext);

return <Wrapper role="region" isActive={isActive} {...props} />;
Expand Down
6 changes: 0 additions & 6 deletions packages/core/src/components/Accordion/Content/types.ts

This file was deleted.

9 changes: 7 additions & 2 deletions packages/core/src/components/Accordion/types.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { WithStyle } from '@medly-components/utils';
import { HTMLProps, WithStyle } from '@medly-components/utils';
import type { Context, Dispatch, FC, SetStateAction } from 'react';

export type StaticProps = {
Header: FC<HeaderProps> & WithStyle;
Content: FC & WithStyle;
Content: FC<ContentProps> & WithStyle;
Context: Context<AccordionContextType>;
};

Expand All @@ -28,3 +28,8 @@ export type AccordionProps = {
export type HeaderProps = {
iconColor?: string;
};

export type ContentProps = HTMLProps<HTMLDivElement> & {
/** Use to render any component as Accordion content */
as?: keyof JSX.IntrinsicElements | React.ComponentType<any>;
};

0 comments on commit c2f5625

Please sign in to comment.