<commit_before>/**
 * Created by mgab on 05/05/2017.
 */

import Button from './styled-components/Button'
import StyledDialog from './styled-components/StyledDialog'
import React, { Component } from 'react'
import propTypes from 'prop-types'

class Dialog extends Component {

  componentWillUnmount() {
    document.body.classList.remove('DialogModalOpen')
  }

  componentDidMount() {
    if (this.props.modal) {
      document.body.classList.add('DialogModalOpen')
    }
  }

  render() {
    return (
      <StyledDialog>
        <div className={this.props.modal ? 'DialogModal__wrap' : null}>
          <div className='Dialog__header'>{this.props.header}</div>
          <div className='Dialog__body'>{this.props.children}</div>
          <div className='Dialog__footer'>
            <Button onClick={this.props.onAction.bind(this)}
                    className={this.props.className}
                    type={this.props.type}>
              {this.props.confirmLabel}
            </Button>
          </div>
        </div>
      </StyledDialog>
    )
  }
}

Dialog.propTypes = {
  header: propTypes.string.isRequired,
  confirmLabel: propTypes.string,
  modal: propTypes.bool,
  onAction: propTypes.func,
  type: propTypes.string,
  className: propTypes.string
}

Dialog.defaultProps = {
  confirmLabel: 'ok',
  modal: false,
  onAction: () => {
  }
}

export default Dialog<commit_msg>Cleaned the Dialog component.<commit_after>/**
 * Created by mgab on 05/05/2017.
 */

import Button from './styled-components/Button'
import StyledDialog from './styled-components/StyledDialog'
import React, { Component } from 'react'
import propTypes from 'prop-types'

class Dialog extends Component {
  render() {
    return (
      <StyledDialog>
        <div>
          <div className='Dialog__header'>{this.props.header}</div>
          <div className='Dialog__body'>{this.props.children}</div>
          <div className='Dialog__footer'>
            <Button onClick={this.props.onAction.bind(this)}
                    className={this.props.className}
                    type={this.props.type}>
              {this.props.confirmLabel}
            </Button>
          </div>
        </div>
      </StyledDialog>
    )
  }
}

Dialog.propTypes = {
  header: propTypes.string.isRequired,
  confirmLabel: propTypes.string,
  onAction: propTypes.func,
  type: propTypes.string,
  className: propTypes.string
}

Dialog.defaultProps = {
  confirmLabel: 'ok',
  onAction: () => {
  }
}

export default Dialog
{'fraction_non_alphanumeric': 0.13170536429143315, 'fraction_numerical': 0.006405124099279423, 'mean_word_length': 2.675, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1056021', 'n_tokens_mistral': 766, 'n_tokens_neox': 740, 'n_words': 143}