React components that implement Google's Material Design.
Integrated with Code.Gamelet.
Open a pre-defined dialog:
// Alert Dialog
CG.ReactMaterial.dialogs.openAlertDialog({
title: 'Alert!!!',
message: 'Something is happening.',
onClose: () => {
console.log('dialog is closed');
};
// Confirm Dialog
CG.ReactMaterial.dialogs.openConfirmDialog({
title: 'Delete File',
message: 'Are you sure?',
onConfirm: () => {
console.log('user confirmed');
};
// Input Dialog
CG.ReactMaterial.dialogs.openInputDialog({
title: 'What\'s your name?',
message: 'Your name will be shown in the highscore board.',
onConfirm: (value: string) => {
console.log('name = ' + value);
};
To write your own React element:
CG.React.renderElement(
<div>
<materialUI.TextField
id="name"
label="Name"
margin="normal"
/>
<materialUI.Button variant="contained" color="primary" size="small" className={classes.button}>
Send
<materialUI.Icon>send</materialUI.Icon>
</materialUI.Button>
</div>
);
We use SemVer for versioning.