1.0.1 • Published 6 years ago
webstack-dialog v1.0.1
Components
Dialog
import { DialogConfig, Dialog } from 'webstack-dialog'
...
class CustomComponent extend Component {
handleClick = () => {
const conf = new DialogConfig('Write your details')
.addString('FirstName', 'firstName')
.addString('LastName', 'lastName')
.addNumber('Age', 'age', value => value < 18? 'Age must be 18 or above!' : false, 18)
.addSelect('Gender', 'gender', [{id: 0, label: 'male'}, {id: 2, label: 'female'}], value => value? true : 'required')
.addAuto('Birthplace', 'birthplace', ['Czeckia','Japan', '...'], '')
this._dialog.show(conf, result => {
//result === { firstName: ?, lastName: ?, age: ?, gender: ?, birthplace: ?}
this._dialog.hide();
})
}
render() {
return (
<div>
<FlatButton onClick={this.handleClick}>
<Dialog ref={i = this._dialog = i}/>
</div>
)
}
}
...