-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Expand file tree
/
Copy pathsamples.tsx
More file actions
47 lines (43 loc) · 1.13 KB
/
samples.tsx
File metadata and controls
47 lines (43 loc) · 1.13 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
import styled from '../styled-components';
import { PrismDiv } from './PrismDiv';
export const SampleControls = styled.div`
opacity: 0.7;
transition: opacity 0.3s ease;
text-align: right;
&:focus-within {
opacity: 1;
}
> button {
background-color: transparent;
border: 0;
color: inherit;
padding: 2px 10px;
font-family: ${({ theme }) => theme.typography.fontFamily};
font-size: ${({ theme }) => theme.typography.fontSize};
line-height: ${({ theme }) => theme.typography.lineHeight};
cursor: pointer;
outline: 0;
:hover,
:focus {
background: rgba(255, 255, 255, 0.1);
}
}
`;
export const SampleControlsWrap = styled.div`
&:hover ${SampleControls} {
opacity: 1;
}
`;
export const StyledPre = styled(PrismDiv).attrs({
as: 'pre',
})`
font-family: ${props => props.theme.typography.code.fontFamily};
font-size: ${props => props.theme.typography.code.fontSize};
overflow-x: auto;
margin: 0;
padding: 10px;
border-radius: 4px;
background-color: rgb(50, 63, 75);
contain: content;
white-space: ${({ theme }) => (theme.typography.code.wrap ? 'pre-wrap' : 'pre')};
`;