diff --git a/client/.babelrc b/client/.babelrc
index 9dbc27740..c3f3f4606 100644
--- a/client/.babelrc
+++ b/client/.babelrc
@@ -1,7 +1,20 @@
{
"presets": ["next/babel"],
"plugins": [
- "inline-react-svg",
+ [
+ "inline-react-svg",
+ {
+ "svgo": {
+ "plugins": [
+ {
+ "cleanupIDs": {
+ "minify": false
+ }
+ }
+ ]
+ }
+ }
+ ],
[
"styled-components",
{
diff --git a/client/src/components/Alert.js b/client/src/components/Alert.js
new file mode 100644
index 000000000..f6094644a
--- /dev/null
+++ b/client/src/components/Alert.js
@@ -0,0 +1,140 @@
+import React from 'react'
+import { Box, Button, Text } from 'grommet'
+import styled from 'styled-components'
+
+import Info from '../images/info-white.svg'
+import Warning from '../images/warning-white.svg'
+import Check from '../images/check-white.svg'
+import Cross from '../images/cross-white.svg'
+
+const types = {
+ info: {
+ Icon: Info,
+ background: 'brand',
+ multipleBackground: 'turteal-shade-20',
+ color: 'white'
+ },
+ error: {
+ Icon: Warning,
+ background: 'error',
+ multipleBackground: 'error-shade-20',
+ color: 'white'
+ },
+ success: {
+ Icon: Check,
+ background: 'success',
+ multipleBackground: 'success-shade-20',
+ color: 'white'
+ }
+}
+
+const CloseAlertButton = styled(Button)`
+ text-align: right;
+ padding-right: 16px;
+`
+
+export const Alert = ({
+ type = 'info',
+ message = '',
+ height = '56px',
+ onRemove
+}) => {
+ const { background, color, Icon } = types[type]
+
+ return (
+
+
+
+ {Icon && (
+
+
+
+ )}
+
+ {message}
+
+
+
+
+ } onClick={onRemove} />
+
+
+ )
+}
+
+const MultipleAlerts = ({ alert, alerts, clearAlerts }) => {
+ const { multipleBackground, color } = types[alert.type]
+ return (
+
+
+
+ {alerts.length} Alerts
+
+
+
+
+
+
+ )
+}
+
+export const Alerts = ({ lifo = true, alerts, removeAlert, clearAlerts }) => {
+ if (alerts.length === 0) return <>>
+
+ const alert = lifo ? alerts[alerts.length - 1] : alerts[0]
+
+ return (
+ <>
+ {alerts.length > 1 && (
+
+ )}
+ {alerts.length > 0 && (
+ {
+ removeAlert(alert)
+ }}
+ />
+ )}
+ >
+ )
+}
+
+export const AlertsWithQueue = ({ lifo = true, queue }) => {
+ const { alerts, clearAlerts, removeAlert } = queue
+ return (
+
+ )
+}
+
+export default Alert
diff --git a/client/src/components/Alert.stories.js b/client/src/components/Alert.stories.js
new file mode 100644
index 000000000..d3616cb59
--- /dev/null
+++ b/client/src/components/Alert.stories.js
@@ -0,0 +1,62 @@
+import * as React from 'react'
+import { Grommet, Box, Button } from 'grommet'
+import { storiesOf } from '@storybook/react'
+import { useAlertsQueue } from '../hooks/useAlertsQueue'
+import { Alert, AlertsWithQueue } from './Alert'
+import theme from '../theme'
+
+storiesOf('Alert', module).add('default', () => {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+ )
+})
+
+storiesOf('Alert', module).add('Alerts', () => {
+ const alertsQueue = useAlertsQueue('demo1')
+
+ // This is to demonstate how you can use queues and context
+ // This would be in some child component or somewhere else
+ const { addAlert } = useAlertsQueue('demo1')
+ return (
+
+
+
+
+
+
+
+
+
+ )
+})
diff --git a/client/src/hooks/useAlertsQueue.js b/client/src/hooks/useAlertsQueue.js
new file mode 100644
index 000000000..3083bad49
--- /dev/null
+++ b/client/src/hooks/useAlertsQueue.js
@@ -0,0 +1,42 @@
+import React from 'react'
+
+export const AlertsContext = React.createContext({ alerts: {} })
+
+export const useAlertsQueue = (queue = 'main') => {
+ const context = React.useContext(AlertsContext)
+
+ const [alerts, setAlerts] = React.useState(context.alerts)
+
+ if (!alerts[queue]) alerts[queue] = []
+
+ const addAlert = (message, type = 'info') => {
+ context.alerts[queue].push({
+ time: Date.now(),
+ message,
+ type
+ })
+ setAlerts({ ...context.alerts })
+ }
+
+ const removeAlert = (alertToRemove) => {
+ const newAlerts = context.alerts[queue].filter((a) => {
+ return a.time !== alertToRemove.time
+ })
+ context.alerts[queue] = newAlerts
+ setAlerts({ ...context.alerts })
+ }
+
+ const clearAlerts = () => {
+ context.alerts[queue] = []
+ setAlerts({ ...context.alerts })
+ }
+
+ return {
+ alerts: context.alerts[queue],
+ addAlert,
+ clearAlerts,
+ removeAlert
+ }
+}
+
+export default useAlertsQueue
diff --git a/client/src/images/check-green.svg b/client/src/images/check-green.svg
new file mode 100644
index 000000000..d87977d72
--- /dev/null
+++ b/client/src/images/check-green.svg
@@ -0,0 +1,24 @@
+
+
diff --git a/client/src/images/check-white.svg b/client/src/images/check-white.svg
new file mode 100644
index 000000000..85ee5ca53
--- /dev/null
+++ b/client/src/images/check-white.svg
@@ -0,0 +1,24 @@
+
+
diff --git a/client/src/images/cite.svg b/client/src/images/cite.svg
new file mode 100644
index 000000000..195be6018
--- /dev/null
+++ b/client/src/images/cite.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/client/src/images/cross-black-tint-30.svg b/client/src/images/cross-black-tint-30.svg
new file mode 100644
index 000000000..91e35198a
--- /dev/null
+++ b/client/src/images/cross-black-tint-30.svg
@@ -0,0 +1,24 @@
+
+
\ No newline at end of file
diff --git a/client/src/images/cross-white.svg b/client/src/images/cross-white.svg
new file mode 100644
index 000000000..221442741
--- /dev/null
+++ b/client/src/images/cross-white.svg
@@ -0,0 +1,24 @@
+
+
diff --git a/client/src/images/deliver.svg b/client/src/images/deliver.svg
new file mode 100644
index 000000000..156c107f9
--- /dev/null
+++ b/client/src/images/deliver.svg
@@ -0,0 +1,34 @@
+
+
\ No newline at end of file
diff --git a/client/src/images/details.svg b/client/src/images/details.svg
new file mode 100644
index 000000000..6999ed525
--- /dev/null
+++ b/client/src/images/details.svg
@@ -0,0 +1,34 @@
+
+
\ No newline at end of file
diff --git a/client/src/images/edit.svg b/client/src/images/edit.svg
new file mode 100644
index 000000000..17e9d5714
--- /dev/null
+++ b/client/src/images/edit.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/client/src/images/file-pdf.svg b/client/src/images/file-pdf.svg
new file mode 100644
index 000000000..d4c3ee737
--- /dev/null
+++ b/client/src/images/file-pdf.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/client/src/images/grant.svg b/client/src/images/grant.svg
new file mode 100644
index 000000000..a18423d47
--- /dev/null
+++ b/client/src/images/grant.svg
@@ -0,0 +1,34 @@
+
+
\ No newline at end of file
diff --git a/client/src/images/info-blue.svg b/client/src/images/info-blue.svg
new file mode 100644
index 000000000..bdc0f399a
--- /dev/null
+++ b/client/src/images/info-blue.svg
@@ -0,0 +1,26 @@
+
+
\ No newline at end of file
diff --git a/client/src/images/info-white.svg b/client/src/images/info-white.svg
new file mode 100644
index 000000000..6f2aaf5d5
--- /dev/null
+++ b/client/src/images/info-white.svg
@@ -0,0 +1,26 @@
+
+
diff --git a/client/src/images/mta.svg b/client/src/images/mta.svg
new file mode 100644
index 000000000..30ded6c6a
--- /dev/null
+++ b/client/src/images/mta.svg
@@ -0,0 +1,36 @@
+
+
\ No newline at end of file
diff --git a/client/src/images/organism.svg b/client/src/images/organism.svg
index a87d53ffe..116da7694 100644
--- a/client/src/images/organism.svg
+++ b/client/src/images/organism.svg
@@ -4,31 +4,27 @@
badges/organism
Created with Sketch.
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/client/src/images/resource-type.svg b/client/src/images/resource-type.svg
index 0e3ad59d7..e9c50dbaf 100644
--- a/client/src/images/resource-type.svg
+++ b/client/src/images/resource-type.svg
@@ -4,31 +4,27 @@
badges/resource-type
Created with Sketch.
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/client/src/images/warning-black-tint-30.svg b/client/src/images/warning-black-tint-30.svg
new file mode 100644
index 000000000..03d49b7f0
--- /dev/null
+++ b/client/src/images/warning-black-tint-30.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/client/src/images/warning-red.svg b/client/src/images/warning-red.svg
new file mode 100644
index 000000000..3c402b94a
--- /dev/null
+++ b/client/src/images/warning-red.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/client/src/images/warning-white.svg b/client/src/images/warning-white.svg
new file mode 100644
index 000000000..83f1b8191
--- /dev/null
+++ b/client/src/images/warning-white.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/client/src/theme.js b/client/src/theme.js
index fa8f8cdf3..bf284dc72 100644
--- a/client/src/theme.js
+++ b/client/src/theme.js
@@ -26,6 +26,7 @@ const theme = {
},
extend: (props) =>
!props.role &&
+ !props.plain &&
`
${
!props.primary &&
@@ -379,12 +380,13 @@ const theme = {
white: '#FDFDFD',
info: '#002F6C', // alexs-navy-base
success: '#41A36D',
+ 'success-shade-20': '#348257',
error: '#DB3B28',
+ 'error-shade-20': '#A72A1B',
warning: '#DACE00', // alexs-lemon-shade-10
'active-background': 'brand',
'active-text': 'text-strong',
'background-highlight': '#F2F2F2',
-
background: {
dark: '#111111',
light: 'white'