react-redux-snackbar
react-redux-snackbar copied to clipboard
Way to show error, success, info messages
Is there a way I can set style by providing styles in the dispatch statement?
Not in the dispatch statement, but when adding the component to the page, loke so:
const snackStyles = {
snack: {
width: '300px',
textAlign: 'center',
},
};
<Snackbar customStyles={snackStyles}/>
I'll add more documentation about it soon.
But I guess you would want different looks, e.g depending on if its an error or info message. I'll figure out a solution for that.
I guess adding a type property would work:
dispatch(showSnack('id', {
label: 'saved',
type: 'error' // info (default) | warning | error | success
}));
This attribute can than be translated to a className or styles on the snackbar.
@wireforce providing a Example Project on how to use react-redux-snackbar will be a great add-on.