forked from codesandbox/codesandbox-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathelements.js
More file actions
78 lines (68 loc) · 1.84 KB
/
elements.js
File metadata and controls
78 lines (68 loc) · 1.84 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
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
import styled from 'styled-components';
import css from '@styled-system/css';
import { CodeSandboxIcon as CodeSandboxIconBase } from '@codesandbox/common/lib/components/icons/CodeSandbox';
import { PreviewIcon as PreviewIconBase } from '@codesandbox/common/lib/components/icons/Preview';
import { HeartIconSVG, ReloadIconSVG, NewWindowIconSVG } from './icons';
export const Container = styled.div(props =>
css({
position: 'absolute',
[props.align]: 16,
zIndex: 99,
display: 'flex',
// margin between consecutive elements
'* + *': {
marginLeft: 1,
},
// 28 is the height of console
bottom: props.isDragging ? -32 : props.offsetBottom ? 28 + 16 : 16,
opacity: props.isDragging ? 0 : 1,
transitionProperty: 'opacity, bottom',
transitionDuration: theme =>
// go out fast, come back slow
props.isDragging ? theme.speed[3] : theme.speed[5],
})
);
export const Button = styled.button(
css({
display: 'inline-flex',
alignItems: 'center',
height: 32,
paddingX: 3,
paddingY: 0,
fontSize: 3,
fontWeight: 'medium',
border: '1px solid',
borderColor: 'grays.600',
color: 'white',
backgroundColor: 'grays.700',
borderRadius: 4,
textDecoration: 'none',
cursor: 'pointer',
':hover': {
backgroundColor: 'grays.600',
},
})
);
export const HeartIcon = styled(HeartIconSVG)(props =>
css({
path: {
stroke: props.liked ? 'reds.300' : 'white',
fill: props.liked ? 'reds.300' : 'none',
},
})
);
export const IconButton = styled(Button)`
padding: 0 3px;
`;
export const CodeSandboxIcon = styled(CodeSandboxIconBase)(() =>
css({
fontSize: 28,
})
);
export const PreviewIcon = styled(PreviewIconBase)(() =>
css({
fontSize: 28,
})
);
export const ReloadIcon = ReloadIconSVG;
export const NewWindowIcon = NewWindowIconSVG;