-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
elements.js
90 lines (78 loc) · 1.92 KB
/
elements.js
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import styled from 'styled-components';
import theme from '@codesandbox/common/lib/theme';
export const Container = styled.div`
position: relative;
width: 300px;
padding: 1rem 0;
color: white;
border-radius: 2px;
box-shadow: 0px 2px 7px 0px rgba(0, 0, 0, 0.4);
overflow: hidden;
border-left: 2px solid transparent;
border-color: ${props => {
if (props.type === 'error') return theme.red.darken(0.2)();
if (props.type === 'warning') return theme.primary.darken(0.2);
if (props.type === 'success') return theme.green();
return theme.secondary();
}};
background-color: ${theme.background2.darken(0.2)()};
`;
export const Content = styled.div`
display: flex;
align-items: center;
padding: 0 1rem;
height: 100%;
vertical-align: middle;
line-height: 1.15;
box-sizing: border-box;
color: ${() => theme.white()};
font-size: 1rem;
span {
flex: 11;
}
svg {
flex: 1;
}
`;
export const Title = styled.span`
display: inline-block;
font-weight: 400;
margin: 0;
`;
export const Buttons = styled.div`
position: absolute;
bottom: 0;
left: 0;
right: 0;
display: flex;
flex: auto;
`;
export const Button = styled.div`
transition: 0.3s ease all;
position: relative;
display: block;
width: 100%;
text-align: center;
cursor: pointer;
padding: 0.5rem;
background-color: ${props => {
if (props.type === 'error') return theme.redBackground.lighten(0.2);
if (props.type === 'warning') return theme.primary.darken(0.5);
return theme.secondary.darken(0.1);
}};
font-weight: 500;
&:hover {
background-color: ${props => {
if (props.type === 'error') return theme.redBackground.lighten(0.1);
if (props.type === 'warning') return theme.primary.darken(0.6);
return theme.secondary.darken(0.2);
}};
}
`;
export const CloseIconHandler = styled.div`
position: absolute;
top: 6px;
right: 6px;
color: white;
cursor: pointer;
`;