File tree Expand file tree Collapse file tree 1 file changed +15
-20
lines changed Expand file tree Collapse file tree 1 file changed +15
-20
lines changed Original file line number Diff line number Diff line change 11import * as React from 'react' ;
2- import DisplayName from '../helpers/DisplayName' ;
32import { DivAttributes } from '../helpers/types' ;
43import { assertValidHtmlId } from '../helpers/uuid' ;
54import { Consumer as ItemConsumer , ItemContext } from './ItemContext' ;
65
7- type Props = DivAttributes ;
6+ type Props = DivAttributes & { className ?: string } ;
87
9- const defaultProps = {
10- className : 'accordion__panel' ,
11- } ;
12-
13- export default class AccordionItemPanel extends React . Component < Props > {
14- static defaultProps : typeof defaultProps = defaultProps ;
15-
16- static displayName : DisplayName . AccordionItemPanel =
17- DisplayName . AccordionItemPanel ;
18-
19- renderChildren = ( { panelAttributes } : ItemContext ) : JSX . Element => {
20- if ( this . props . id ) {
21- assertValidHtmlId ( this . props . id ) ;
8+ const AccordionItemPanel = ( {
9+ className = 'accordion__panel' ,
10+ id,
11+ ...rest
12+ } : Props ) => {
13+ const renderChildren = ( { panelAttributes } : ItemContext ) : JSX . Element => {
14+ if ( id ) {
15+ assertValidHtmlId ( id ) ;
2216 }
2317
2418 return (
2519 < div
2620 data-accordion-component = "AccordionItemPanel"
27- { ...this . props }
21+ className = { className }
22+ { ...rest }
2823 { ...panelAttributes }
2924 />
3025 ) ;
3126 } ;
3227
33- render ( ) : JSX . Element {
34- return < ItemConsumer > { this . renderChildren } </ ItemConsumer > ;
35- }
36- }
28+ return < ItemConsumer > { renderChildren } </ ItemConsumer > ;
29+ } ;
30+
31+ export default AccordionItemPanel ;
You can’t perform that action at this time.
0 commit comments