PluginProbe
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder / 3.1.4
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder v3.1.4
3.1.4 3.0.8 3.0.9 3.1.0 3.1.2 3.1.3 3.0.7 3.0.5 3.0.4 3.0.3 3.0.2 trunk 1.5.0 1.5.1 1.5.2 1.6.1 1.6.2 1.6.3 1.6.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 All 93 releases
ultimate-store-kit / src / admin / components / Toast.js

Toast.js in Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder 3.1.4, at src/admin/components/Toast.js

33 lines 719 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { createPortal } from '@wordpress/element';
2
3 /**
4 * Fixed top-center toast notification.
5 *
6 * @param {{ notification: { type: string, message: string } | null, onDismiss: () => void }} props
7 */
8 const Toast = ({ notification, onDismiss }) => {
9 if (!notification) return null;
10
11 const typeClass = notification.type === 'success'
12 ? 'usk-toast--success'
13 : 'usk-toast--error';
14
15 return createPortal(
16 <div className="usk-toast-wrap">
17 <div className={`usk-toast ${typeClass}`}>
18 <span>{notification.message}</span>
19 <button
20 type="button"
21 className="usk-toast__close"
22 onClick={onDismiss}
23 >
24 &times;
25 </button>
26 </div>
27 </div>,
28 document.body
29 );
30 };
31
32 export default Toast;
33