Add exit mpr action
This commit is contained in:
1 parent
f07f21117d
commit
8038009afd
2 files changed
+13
-10
No files matched your search
@@ -5,6 +5,10 @@ const SnackbarItem = ({ options, onClose }) => {
|
||||
onClose(options.id);
|
||||
};
|
||||
|
||||
const handleClick = () => {
|
||||
options.action.onClick({ ...options, close: handleClose });
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (options.autoClose) {
|
||||
setTimeout(() => {
|
||||
@@ -25,7 +29,7 @@ const SnackbarItem = ({ options, onClose }) => {
|
||||
{options.title && <div className="sb-title">{options.title}</div>}
|
||||
{options.message && <div className="sb-message">{options.message}</div>}
|
||||
{options.action && (
|
||||
<button className="sb-action" onClick={options.action.onClick}>
|
||||
<button className="sb-action" onClick={handleClick}>
|
||||
{options.action.label}
|
||||
</button>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user