-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor
Accordion
and AccordionItem
- Loading branch information
Showing
7 changed files
with
502 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
import type { ComponentProps, ReactElement, ReactNode } from 'react'; | ||
import type { ReactNode } from 'react'; | ||
|
||
import Box from '../Box'; | ||
import { AccordionItem } from './AccordionItem'; | ||
import { cx, cxx } from '../../helpers/composeClassNames'; | ||
import { StylingBox } from '../Box'; | ||
import { StylingProps } from '../Box/stylingProps'; | ||
|
||
type AccordionProps = ComponentProps<typeof Box> & { | ||
animated?: boolean; | ||
export type AccordionProps = { | ||
children: ReactNode; | ||
}; | ||
} & Partial<StylingProps>; | ||
|
||
/** | ||
* An `Accordion` allows users to toggle the display of sections of content. | ||
*/ | ||
export function Accordion(props: AccordionProps): ReactElement<AccordionProps> { | ||
return <Box animated rcx-accordion {...props} />; | ||
} | ||
const Accordion = ({ children, ...props }: AccordionProps) => ( | ||
<StylingBox {...props}> | ||
<div className={cx(cxx('rcx-box')('full', 'animated'), 'rcx-accordion')}> | ||
{children} | ||
</div> | ||
</StylingBox> | ||
); | ||
|
||
/** | ||
* @deprecated use named import instead | ||
*/ | ||
Accordion.Item = AccordionItem; | ||
export default Accordion; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.