forked from jaruba/PowderWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNotification.js
More file actions
executable file
·49 lines (41 loc) · 1.08 KB
/
Copy pathNotification.js
File metadata and controls
executable file
·49 lines (41 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import React from 'react'
import styled, { css } from 'styled-components'
import { Icon } from 'react-interface'
const Wrapper = styled.div`
padding: 1rem;
text-align: center;
color: #FFF;
position: relative;
top: -1px;
cursor: pointer;
${props => props.type === 'success' && css`
background: ${props => props.theme.success};
`}
${props => props.type === 'warning' && css`
background: ${props => props.theme.warning};
`}
${props => props.type === 'info' && css`
background: ${props => props.theme.info};
`}
${props => props.type === 'error' && css`
background: ${props => props.theme.error};
`}
svg {
height: 20px;
width: 20px;
position: absolute;
right: 10px;
transform: translateY(-50%);
top: 50%;
}
`
const Notification = ({ notification, setNotification }) => (
<Wrapper
type={notification.type}
onClick={notification.dismissable ? () => setNotification(null) : null}
>
<span>{notification.message}</span>
{notification.dismissable && <Icon type="close" />}
</Wrapper>
)
export default Notification