-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Expand file tree
/
Copy pathCodeBlockWithCopy.scss
More file actions
66 lines (52 loc) · 946 Bytes
/
CodeBlockWithCopy.scss
File metadata and controls
66 lines (52 loc) · 946 Bytes
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
@use "../../styles/partials/functions" as *;
.code-block-wrapper {
position: relative;
margin-bottom: 1.5rem;
&:hover .copy-button {
opacity: 1;
}
}
.copy-button {
position: absolute;
top: 0.5rem;
right: 0.5rem;
z-index: 10;
padding: 0.4rem 0.7rem;
border-radius: 0.35rem;
border: none;
cursor: pointer;
font-size: 0.75rem;
font-weight: 500;
/* visible on hover */
opacity: 0;
background-color: getColor(denim);
color: #e2e8f0;
transition:
background-color 0.2s,
transform 0.1s,
opacity 0.3s;
&:hover {
background-color: #2f85d0;
}
/* Success */
&.copied {
background-color: #38a169;
}
&.copied:hover {
background-color: #2f855a;
}
/* Error */
&.error {
background-color: #e53e3e;
}
&.error:hover {
background-color: #c53030;
}
&:focus-visible {
outline: none;
opacity: 1;
}
&:active {
transform: scale(0.95);
}
}