<commit_before>import React from 'react';
import { Button, Glyphicon } from 'react-bootstrap';

var GlyphButton = React.createClass({
    propTypes: {
        bsStyle: React.PropTypes.string,
        bsSize: React.PropTypes.string,
        text: React.PropTypes.string,
        glyph: React.PropTypes.string.isRequired,
        onClick: React.PropTypes.func
    },
    handleSave: function () {
        if (this.props.onClick) {
            this.props.onClick();
        }
    },
    render: function () {
        let text = this.props.text ? <span style={{marginLeft:6}}>{this.props.text}</span> : null;
        return <Button
            bsStyle={this.props.bsStyle}
            bsSize={this.props.bsSize}
            onClick={this.handleSave}>
            <Glyphicon glyph={this.props.glyph}/>
            {text}
        </Button>;
    }
});

export default GlyphButton;<commit_msg>Start es6-refactor: - Replaced React.createClass for es6 class and reduce methods in render to extract them as es6 class properties in order to get better readability. - Refactor in GlyphButton<commit_after>import React, { Component, PropTypes } from 'react';
import Glyphicon from 'react-bootstrap/lib/Glyphicon';
import Button from 'react-bootstrap/lib/Button';

class GlyphButton extends Component {
    static propTypes = {
        bsStyle: PropTypes.string,
        bsSize: PropTypes.string,
        text: PropTypes.string,
        glyph: PropTypes.string.isRequired,
        onClick: PropTypes.func
    };

    handleSave = () => {
        let { onClick } = this.props;

        if (onClick) {
            onClick();
        }
    };

    getText = () => {
        let style = { marginLeft: 6 };
        let { text } = this.props;

        if (text) {
            return (
                <span style={style}>
                    { text }
                </span>
            );
        } else {
            return null;
        }
    };

    render() {
        let { bsSize, bsStyle,glyph } = this.props;

        return (
            <Button bsStyle={bsStyle} bsSize={bsSize} onClick={this.handleSave}>
                <Glyphicon glyph={glyph}/>
                { this.getText() }
            </Button>
        )
    }
}

export default GlyphButton;
{'fraction_non_alphanumeric': 0.11825078090138331, 'fraction_numerical': 0.0022311468094600626, 'mean_word_length': 1.9192708333333333, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, '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': '4866477', 'n_tokens_mistral': 652, 'n_tokens_neox': 630, 'n_words': 146}