/
PathlineRenderer.tsx
39 lines (36 loc) · 983 Bytes
/
PathlineRenderer.tsx
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
import React from 'react';
import copy from 'clipboard-copy';
import { MdContentCopy } from 'react-icons/md';
import ToolbarButton from 'rsg-components/ToolbarButton';
import Styled, { JssInjectedProps } from 'rsg-components/Styled';
import * as Rsg from '../../../typings';
export const styles = ({ space, fontFamily, fontSize, color }: Rsg.Theme) => ({
pathline: {
fontFamily: fontFamily.monospace,
fontSize: fontSize.small,
color: color.light,
wordBreak: 'break-all',
},
copyButton: {
marginLeft: space[0],
},
});
export const PathlineRenderer: React.FunctionComponent<JssInjectedProps> = ({
classes,
children,
}) => {
return (
<div className={classes.pathline}>
{children}
<ToolbarButton
small
className={classes.copyButton}
onClick={() => children && copy(children.toString())}
title="Copy to clipboard"
>
<MdContentCopy />
</ToolbarButton>
</div>
);
};
export default Styled<JssInjectedProps>(styles)(PathlineRenderer);