Codeminer42/cm42-central

View on GitHub
app/assets/javascripts/components/Notifications/index.jsx

Summary

Maintainability
A
0 mins
Test Coverage
import React from 'react';
import Message from './Message';
import PropTypes from 'prop-types';

const Notifications = ({ notifications, onRemove }) => (
  <div className="Notifications">
    {notifications.map(notification => (
      <Message
        className="Notifications__Message"
        message={notification.message}
        type={notification.type}
        onRemove={() => onRemove(notification.id)}
        key={notification.id}
      />
    ))}
  </div>
);

Notifications.propTypes = {
  notifications: PropTypes.array.isRequired,
  onRemove: PropTypes.func.isRequired,
};

export default Notifications;