ManageIQ/manageiq-ui-classic

View on GitHub
app/javascript/components/toast-list/toast-list.jsx

Summary

Maintainability
A
0 mins
Test Coverage
/* eslint-disable jsx-a11y/anchor-is-valid */
import React from 'react';
import { useSelector } from 'react-redux';
import ToastItem from './toast-item';

const ToastList = () => {
  const toastNotifications = useSelector(({ notificationReducer: { toastNotifications } }) => toastNotifications);

  return (
    toastNotifications.length > 0 ? (
      <div id="toastnotification" className="toast-notification">
        {toastNotifications.slice(-3).map((toastNotification) => (
          <ToastItem toastNotification={toastNotification} key={toastNotification.id} />
        ))}
      </div>
    ) : null
  );
};

export default ToastList;