import React from 'react';
import PropTypes from 'prop-types';
import SVGIcon from './SVGIcon.js';
class Accordion extends React.Component {
constructor(props) {
super(props);
this.state = {
open: props.defaultExpanded
};
}
render() {
const { children, title, className, dataTestId } = this.props;
const { open } = this.state;
return (
this.setState({ open: !open })} className='sdc-accordion-header'>
{title}
{children}
);
}
}
Accordion.propTypes = {
title: PropTypes.string,
children: PropTypes.node,
expandByDefault: PropTypes.bool,
dataTestId: PropTypes.string
};
Accordion.defaultProps = {
title: '',
className: '',
defaultExpanded: false
};
export default Accordion;