1.0.1 • Published 6 years ago

webstack-dialog v1.0.1

Weekly downloads
1
License
ISC
Repository
-
Last release
6 years ago

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>
		)
	}
} 
...
1.0.1

6 years ago

1.0.0

6 years ago