forked from codesandbox/codesandbox-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathelements.ts
More file actions
74 lines (63 loc) · 1.59 KB
/
elements.ts
File metadata and controls
74 lines (63 loc) · 1.59 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
import styled, { css } from 'styled-components';
import { Scrollbar } from 'react-scrollbars-custom';
export const Container = styled(Scrollbar)`
flex: 1 1 auto;
`;
export const BaseScroller = styled.span`
::-webkit-scrollbar {
width: 0;
height: 0;
}
`;
const thumb = ({ position = true } = {}) => css`
${position ? `width` : `height`}: 0.8rem;
border-radius: 50px;
border: 0.5px solid rgba(255, 255, 255, 0.8);
background: rgba(36, 36, 36, 0.4);
box-sizing: border-box;
opacity: 0.4;
cursor: pointer;
transition: opacity 0.1s ease-in-out;
&:hover,
&:active {
opacity: 1;
}
`;
const track = ({ position = true } = {}) => css`
${position ? `top` : `bottom`}: 0;
${position ? `right` : `left`}: 0;
display: flex;
${position ? `justify-content` : `align-items`}: center;
${position ? `width: 0.5rem !important` : `height: 0.5rem !important`};
padding: 0.25rem;
background-color: transparent !important;
cursor: pointer;
`;
export const BaseTrackX = styled.span`
${track({ position: false })}
`;
export const BaseTrackY = styled.span`
${track({ position: true })}
&:after {
content: '';
position: absolute;
bottom: -1rem;
right: 0;
width: 1rem;
height: 1rem;
background-color: rgba(255, 255, 255, 0.35);
user-select: none;
speak: none;
}
`;
export const BaseThumbX = styled.span`
${thumb({ position: false })}
`;
export const BaseThumbY = styled.span`
${thumb({ position: true })}
`;
export const BaseWrapper = styled.span`
/* We want to overlay the scrollbar */
right: 0 !important;
bottom: 0 !important;
`;