+`;
diff --git a/src/components/BannerNotifications/Notification/index.js b/src/components/BannerNotification/index.js
similarity index 58%
rename from src/components/BannerNotifications/Notification/index.js
rename to src/components/BannerNotification/index.js
index d4d1ed9..819c8f1 100644
--- a/src/components/BannerNotifications/Notification/index.js
+++ b/src/components/BannerNotification/index.js
@@ -27,24 +27,35 @@ function getClassName(type) {
}
}
-const Notification = ({type, message, onClose}) => (
-
+/**
+ * This is a single component used in `BannerNotifications` component.
+ */
+const BannerNotification = ({className, type, text, onClose}) => (
+
`;
diff --git a/src/components/BannerNotifications/bannerNotificationsMessageType.js b/src/components/BannerNotifications/bannerNotificationsMessageType.js
new file mode 100644
index 0000000..1a16673
--- /dev/null
+++ b/src/components/BannerNotifications/bannerNotificationsMessageType.js
@@ -0,0 +1,8 @@
+import PropTypes from 'prop-types';
+
+export default PropTypes.shape({
+ text: PropTypes.string.isRequired,
+ type: PropTypes.oneOf(['alert', 'warning', 'success', 'message']).isRequired,
+ id: PropTypes.string.isRequired,
+ permanent: PropTypes.bool,
+});
diff --git a/src/components/BannerNotifications/index.js b/src/components/BannerNotifications/index.js
index de66303..baaf610 100644
--- a/src/components/BannerNotifications/index.js
+++ b/src/components/BannerNotifications/index.js
@@ -1,34 +1,84 @@
import React from 'react';
import PropTypes from 'prop-types';
-import Notification from './Notification';
+import BannerNotification from '../BannerNotification';
-const BannerNotifications = ({messages, onClose}) => {
- if (messages.length === 0) {
- return null;
+import messageType from './bannerNotificationsMessageType';
+
+/**
+ * Component used to create notifications. For full functionality it needs some
+ * app logic to handle the array of messages - adding/removing.
+ *
+ * See the following:
+ * - https://github.com/Wikia/f2/blob/master/frontend/react-app/curationTools/containers/Notifications.jsx
+ * - https://github.com/Wikia/f2/tree/master/frontend/react-app/curationTools/reducers/notifications
+ *
+ * The `messages` prop is an array of `bannerNotificationsMessageType` objects with the following props:
+ * - `id`: unique string that's send as the param of the `onClose` function
+ * - `type`: one of: `'alert'`, `'warning'`, `'success'` or `'message'`.
+ * - `text`: text that is going to be displayed on the notification
+ * - `permanent`: a boolean flag - if present the close button won't be displayed on the notification
+ *
+ * `bannerNotificationsMessageType` is exported along with `BannerNotification`
+ */
+class BannerNotifications extends React.Component {
+ constructor(props) {
+ super(props);
+
+ this.onClose = this.onClose.bind(this);
}
- return (
-