<commit_before>// (C) Copyright 2014-2016 Hewlett Packard Enterprise Development LP

import React, { Component, PropTypes } from 'react';
import classnames from 'classnames';
import Header from './Header';
import Heading from './Heading';
import ListItem from './ListItem';
import TabNextIcon from './icons/base/TabNext';
import Collapsible from './Collapsible';

import CSSClassnames from '../utils/CSSClassnames';

const CLASS_ROOT = CSSClassnames.ACCORDION_PANEL;

export default class AccordionPanel extends Component {
  constructor (props) {
    super(props);
    this._onClickPanel = this._onClickPanel.bind(this);
    this.state = {
      isOpen: props.isOpen || false
    };
  }

  componentWillReceiveProps (nextProps) {
    if (this.props.isOpen !== nextProps.isOpen) {
      this.setState({ isOpen: nextProps.isOpen });
    }
  }

  _onClickPanel () {
    this.setState({ isOpen : !this.state.isOpen });
    this.props.onTitleClick();
  }

  render () {
    const { animate, className, children, title } = this.props;

    const classes = classnames(
      CLASS_ROOT,
      className,
      {
        [`${CLASS_ROOT}--active`]: this.state.isOpen
      }
    );

    return (
      <ListItem className={classes} direction="column" pad="none">
        <Header
          className={`${CLASS_ROOT}-heading`}
          pad={{horizontal: 'medium', vertical: 'small'}}
          full="horizontal"
          direction="row"
          justify="between"
          align="center"
          onClick={this._onClickPanel}
          responsive={false}
        >
          <Heading tag="h2" margin="none">{title}</Heading>
          <TabNextIcon />
        </Header>
        <Collapsible isOpen={this.state.isOpen} animate={animate}>
          {children}
        </Collapsible>
      </ListItem>
    );
  }
};

AccordionPanel.propTypes = {
  animate: PropTypes.bool,
  title: PropTypes.string.isRequired
};
<commit_msg>Change title -> heading & allow node to be passed<commit_after>// (C) Copyright 2014-2016 Hewlett Packard Enterprise Development LP

import React, { Component, PropTypes } from 'react';
import classnames from 'classnames';
import Header from './Header';
import ListItem from './ListItem';
import TabNextIcon from './icons/base/TabNext';
import Collapsible from './Collapsible';

import CSSClassnames from '../utils/CSSClassnames';

const CLASS_ROOT = CSSClassnames.ACCORDION_PANEL;

export default class AccordionPanel extends Component {
  constructor (props) {
    super(props);
    this._onClickPanel = this._onClickPanel.bind(this);
    this.state = {
      isOpen: props.isOpen || false
    };
  }

  componentWillReceiveProps (nextProps) {
    if (this.props.isOpen !== nextProps.isOpen) {
      this.setState({ isOpen: nextProps.isOpen });
    }
  }

  _onClickPanel () {
    this.setState({ isOpen : !this.state.isOpen });
    this.props.onTitleClick();
  }

  render () {
    const { animate, className, children, heading } = this.props;

    const classes = classnames(
      CLASS_ROOT,
      className,
      {
        [`${CLASS_ROOT}--active`]: this.state.isOpen
      }
    );

    return (
      <ListItem className={classes} direction="column" pad="none">
        <Header
          className={`${CLASS_ROOT}-heading`}
          pad={{horizontal: 'medium', vertical: 'small'}}
          full="horizontal"
          direction="row"
          justify="between"
          align="center"
          onClick={this._onClickPanel}
          responsive={false}
        >
          {heading}
          <TabNextIcon />
        </Header>
        <Collapsible isOpen={this.state.isOpen} animate={animate}>
          {children}
        </Collapsible>
      </ListItem>
    );
  }
};

AccordionPanel.propTypes = {
  animate: PropTypes.bool,
  heading: PropTypes.node.isRequired
};

{'fraction_non_alphanumeric': 0.13247300500395048, 'fraction_numerical': 0.004477218856992362, 'mean_word_length': 2.775347912524851, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1194618', 'n_tokens_mistral': 1142, 'n_tokens_neox': 1117, 'n_words': 243}