1
- import React from 'react' ;
2
- import PropTypes from 'prop-types' ;
1
+ import React from 'react'
2
+ import PropTypes from 'prop-types'
3
3
4
- import Card from './../Card' ;
4
+ import Card from './../Card'
5
5
6
- import { Provider } from './context' ;
6
+ import { Provider } from './context'
7
7
8
8
export class Accordion extends React . Component {
9
9
static propTypes = {
@@ -15,36 +15,36 @@ export class Accordion extends React.Component {
15
15
} ;
16
16
17
17
constructor ( props ) {
18
- super ( props ) ;
18
+ super ( props )
19
19
20
20
this . state = {
21
21
isOpen : props . initialOpen
22
- } ;
22
+ }
23
23
24
24
if ( props . open !== 'undefined' && props . onToggle === 'undefined' ) {
25
25
throw new Error ( "Accordion: props.open has to be used combined with props.onToggle " +
26
- "use props.initialOpen to create an uncontrolled Accordion." ) ;
26
+ "use props.initialOpen to create an uncontrolled Accordion." )
27
27
}
28
28
}
29
29
30
30
toggleHandler ( ) {
31
- const { onToggle } = this . props ;
31
+ const { onToggle } = this . props
32
32
33
33
if ( ! onToggle ) {
34
- this . setState ( { isOpen : ! this . state . isOpen } ) ;
34
+ this . setState ( { isOpen : ! this . state . isOpen } )
35
35
} else {
36
- this . onToggle ( ! this . props . open ) ;
36
+ this . onToggle ( ! this . props . open )
37
37
}
38
38
}
39
39
40
40
isOpen ( ) {
41
41
return ! this . props . onToggle ?
42
- this . state . isOpen : this . props . open ;
42
+ this . state . isOpen : this . props . open
43
43
}
44
44
45
45
render ( ) {
46
46
/* eslint-disable-next-line no-unused-vars */
47
- const { className, children, initialOpen, ...otherProps } = this . props ;
47
+ const { className, children, initialOpen, ...otherProps } = this . props
48
48
49
49
return (
50
50
< Provider
@@ -57,6 +57,6 @@ export class Accordion extends React.Component {
57
57
{ children }
58
58
</ Card >
59
59
</ Provider >
60
- ) ;
60
+ )
61
61
}
62
62
}
0 commit comments