Notification.js 755 B

12345678910111213141516171819202122
  1. import { Icon, Notification as _Notification } from "tiny-ui";
  2. const Notification = ({ type, ...props }) => {
  3. let payload = { ...props, placement: "bottomRight" };
  4. if (type && ["info", "success", "warning", "error"].includes(type)) {
  5. _Notification[type](payload);
  6. } else if (type && ["loader", "loading"].includes(type)) {
  7. payload.icon = (
  8. <Icon name="loader" size={32} style={{ marginRight: "1rem" }} spin />
  9. );
  10. _Notification.open(payload);
  11. } else if (type && ["announce", "announcement"].includes(type)) {
  12. payload.icon = (
  13. <Icon name="broadcast" size={32} style={{ marginRight: "1rem" }} />
  14. );
  15. _Notification.open(payload);
  16. } else {
  17. _Notification.open(payload);
  18. }
  19. };
  20. export default Notification;