40 lines
935 B
Plaintext
40 lines
935 B
Plaintext
class SnackbarTest extends React.Component {
|
|
handleSnackbarClick = (event, instance) => {
|
|
console.log('handleSnackbarClick', event, instance);
|
|
this.setState({ active: false });
|
|
};
|
|
|
|
handleSnackbarTimeout = (event, instance) => {
|
|
console.log('handleSnackbarClick', event, instance);
|
|
this.setState({ active: false });
|
|
};
|
|
|
|
handleClick = () => {
|
|
this.setState({ active: true });
|
|
};
|
|
|
|
state = {
|
|
active: false
|
|
};
|
|
|
|
render () {
|
|
return (
|
|
<section>
|
|
<Button label='Show snackbar' raised primary onClick={this.handleClick} />
|
|
<Snackbar
|
|
action='Dismiss'
|
|
active={this.state.active}
|
|
icon='question-answer'
|
|
label='Snackbar action cancel'
|
|
timeout={2}
|
|
onClick={this.handleSnackbarClick}
|
|
onTimeout={this.handleSnackbarTimeout}
|
|
type='cancel'
|
|
/>
|
|
</section>
|
|
);
|
|
}
|
|
}
|
|
|
|
return <SnackbarTest />;
|