<commit_before>import React from 'react';
import PropTypes from 'prop-types';

/**
 * 一個Bootstrap Modal的呼叫
 */
class ModalView extends React.Component {
    /**
     */
    componentDidMount() {
        $(this.modal).modal('show');
        // $(node).on('hidden.bs.modal', this.props.callback(false));
    }

    /**
     * @return {component}
     */
    render() {
        let {title, content, callback} = this.props;
        return (
          <div className="modal fade" ref={(modal) => this.modal = modal}>
            <div className="modal-dialog modal-sm">
              <div className="modal-content">
                <div className="modal-header">
                  <h4 className="modal-title">{title}</h4>
                  <button type="button" className="close" onClick={() => callback(false)}
                     data-dismiss="modal" aria-label="Close">
                      <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div className="modal-body">
                  <p>{content}</p>
                </div>
                <div className="modal-footer">
                  <button type="button" className="btn btn-primary"
                         data-dismiss="modal" onClick={() => callback(true)}>是</button>
                  <button type="button" className="btn btn-secondary"
                         data-dismiss="modal" onClick={() => callback(false)}>否</button>
                </div>
              </div>
            </div>
          </div>
        );
    };
}

ModalView.propTypes = {
    title: PropTypes.string.isRequired,
    content: PropTypes.string.isRequired,
    callback: PropTypes.func.isRequired,
};

export default ModalView;
<commit_msg>修正Modal關閉動畫<commit_after>import React from 'react';
import PropTypes from 'prop-types';

/**
 * 一個Bootstrap Modal的呼叫
 */
class ModalView extends React.Component {
    /**
     */
    componentDidMount() {
        $(this.modal).modal('show');
    }

    /**
     *
     * @param {boolean} result
     */
    hideModal(result) {
      let {callback} = this.props;
      $(this.modal).on('hidden.bs.modal', () => callback(result));
      $(this.modal).modal('hide');
    }

    /**
     * @return {component}
     */
    render() {
        let {title, content} = this.props;
        return (
          <div className="modal fade" ref={(modal) => this.modal = modal}>
            <div className="modal-dialog modal-sm modal-dialog-centered" role="document">
              <div className="modal-content">
                <div className="modal-header">
                  <h4 className="modal-title">{title}</h4>
                  <button type="button" className="close" onClick={() => this.hideModal(false)}
                     aria-label="Close">
                      <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div className="modal-body">
                  <p>{content}</p>
                </div>
                <div className="modal-footer">
                  <button type="button" className="btn btn-primary"
                         onClick={() => this.hideModal(true)}>是</button>
                  <button type="button" className="btn btn-secondary"
                         onClick={() => this.hideModal(false)}>否</button>
                </div>
              </div>
            </div>
          </div>
        );
    };
}

ModalView.propTypes = {
    title: PropTypes.string.isRequired,
    content: PropTypes.string.isRequired,
    callback: PropTypes.func.isRequired,
};

export default ModalView;

{'fraction_non_alphanumeric': 0.15544472152950956, 'fraction_numerical': 0.0011083402604599613, 'mean_word_length': 1.7286470143613, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 60, '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': '2334575', 'n_tokens_mistral': 996, 'n_tokens_neox': 978, 'n_words': 180}