lyef / lyef-switch-button

A switch button (on/off) React component.
MIT License
16 stars 4 forks source link

Not workin for me #11

Open ghost opened 5 years ago

ghost commented 5 years ago

I make the example:

<SwitchButton id="my-button" labelLeft="left" labelRight="right" isChecked disabled action={callbackFunction} />

but the controler does no work. My source:

import React, { Component } from 'react' import PageHeader from '../template/pageHeader' import Grid from '../template/grid' import IconButton from '../template/iconButton' import SwitchButton from 'lyef-switch-button'; import "../../css/main.css" import PT from 'prop-types';

export default class ContasPagarCadastro extends Component {

constructor(props) {
    super(props)
    this.state = { descricao: '', list: {}}
    // this.callbackFunction = this.callbackFunction.bind(this)

    //this.handleChange = this.handleChange.bind(this)
    // this.handleAdd = this.handleAdd.bind(this)
    // this.handleSearch = this.handleSearch.bind(this)
    // this.handleClear = this.handleClear.bind(this)

 //   this.refresh()
}

render() {
    return (
        <div role='form' className='contaspagarCadastro'>
        <PageHeader name='Contas Pagar' small='Cadastro'></PageHeader>
            <Grid cols='12 9 10'>
                <label>Descricao</label>    
                <input id='descricao' className='form-control'
                    placeholder='Descricao'
                    // onChange={props.handleChange}
                    // onKeyUp={keyHandler}
                    // value={props.descricao}
                    ></input>
                </Grid>
                <Grid cols='5 9 5'>
                <label>Valor</label>    
                <input id='valor' className='form-control'
                    placeholder='Valor'
                    // onChange={props.handleChange}
                    // onKeyUp={keyHandler}
                    // value={props.descricao}
                ></input>
                </Grid>
                <Grid cols='5 9 5'>
                <label>Data Vencimento</label>    
                <input id='data_vencimento' className='form-control'
                    placeholder='Data de Vencimento'
                    // onChange={props.handleChange}
                    // onKeyUp={keyHandler}
                    // value={props.descricao}
                ></input>
                </Grid>
                <Grid cols='5 9 5'>
                <SwitchButton
                    id="my-button"
                    labelLeft="left"
                    labelRight="right"
                    isChecked

                />
                </Grid>
        </div>
    )

}

}