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 + + + +