{"size": 958, "ext": "js", "max_stars_repo_path": "src/components/form/form.js", "max_stars_repo_name": "charleyw/react-weui", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/components/form/form.js", "max_issues_repo_name": "charleyw/react-weui", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/components/form/form.js", "max_forks_repo_name": "charleyw/react-weui", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 21.7727272727, "max_line_length": 79, "alphanum_fraction": 0.5104384134}
import React, { Component, PropTypes } from 'react';
import classNames from 'classnames';

/**
 * weui wrapper for form
 *
 */
class Form extends Component {
    static propTypes = {
        /**
         * if this form is use for radios
         *
         */
        radio: PropTypes.bool,
        /**
         * if this form is use for checkbox
         *
         */
        checkbox: PropTypes.bool
    };

    static defaultProps = {
        radio: false,
        checkbox: false
    };

    render() {
        const { children, className, radio, checkbox, ...others } = this.props;
        const cls = classNames({
            'weui-cells': true,
            'weui-cells_form': !radio && !checkbox,
            'weui-cells_radio': radio,
            'weui-cells_checkbox': checkbox,
            [className]: className
        });

        return (
            <div className={cls} {...others}>{children}</div>
        );
    }
};


export default Form;