-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
682 additions
and
111 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
"@rocket.chat/fuselage": minor | ||
--- | ||
|
||
Simplifies `Accordion` and `AccordionItem` | ||
|
||
It removes an obsolete and not accessible toggle switch in `AccordionItem` and eases the internal usage of `Box` to | ||
improve rendering performance. | ||
|
||
Additionally, it adds a new `StylingBox` component that can be used as a wrapper for components that accept styling | ||
props but don't need the weight of the `Box` component prop handling internally. | ||
|
||
Also, it adds a new `cx` and `cxx` helpers to compose class names. |
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
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.