﻿import React, { Fragment } from 'react';


export default class checkbox extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            value: {}

        };
    }


    render() {

            const { id, col, attributes, value, label,  onChange } = this.props;
            const readOnlyAttr = attributes == undefined ? { disabled: 'disabled' } : (attributes.readOnly ? { disabled: 'disabled' } : {});
            const stilo = {display: !!attributes.hidden ?  attributes.hidden :'unset', float: attributes.float ==undefined ? 'left' : attributes.float  };
            return (

                <div className={"col-sm-" + col + " col-md-" + col} style={stilo}>
                    <div className="form-groupCK">
                        <div class="custom-controlck custom-checkbox">
                            <input type="checkbox" class="custom-control-input" name={id} id={id} checked={value} onChange={onChange} {...readOnlyAttr} />
                            <label class="custom-control-label" for={id}> {label} </label>
                        </div>
                    </div>
                </div>

            )
        }
    }
