aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/pages
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-12-05 06:30:31 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-12-05 06:30:31 +0800
commitce013489ecf86ac7ad51e2f2cd435b18d6054993 (patch)
tree13a7bb676dfb6cf2b463242a41c4cad1f0fcd6c2 /packages/website/ts/pages
parent8ad114c5e585adb5afee2815b4afd0609830ebe3 (diff)
downloaddexon-0x-contracts-ce013489ecf86ac7ad51e2f2cd435b18d6054993.tar
dexon-0x-contracts-ce013489ecf86ac7ad51e2f2cd435b18d6054993.tar.gz
dexon-0x-contracts-ce013489ecf86ac7ad51e2f2cd435b18d6054993.tar.bz2
dexon-0x-contracts-ce013489ecf86ac7ad51e2f2cd435b18d6054993.tar.lz
dexon-0x-contracts-ce013489ecf86ac7ad51e2f2cd435b18d6054993.tar.xz
dexon-0x-contracts-ce013489ecf86ac7ad51e2f2cd435b18d6054993.tar.zst
dexon-0x-contracts-ce013489ecf86ac7ad51e2f2cd435b18d6054993.zip
feat: add copy code feature
Diffstat (limited to 'packages/website/ts/pages')
-rw-r--r--packages/website/ts/pages/instant/code_demo.tsx20
1 files changed, 17 insertions, 3 deletions
diff --git a/packages/website/ts/pages/instant/code_demo.tsx b/packages/website/ts/pages/instant/code_demo.tsx
index 4fe1928f5..9a04fceed 100644
--- a/packages/website/ts/pages/instant/code_demo.tsx
+++ b/packages/website/ts/pages/instant/code_demo.tsx
@@ -1,5 +1,10 @@
import * as React from 'react';
+import * as CopyToClipboard from 'react-copy-to-clipboard';
import SyntaxHighlighter from 'react-syntax-highlighter';
+
+import { Button } from 'ts/components/ui/button';
+import { Container } from 'ts/components/ui/container';
+import { Text } from 'ts/components/ui/text';
import { colors } from 'ts/style/colors';
import { styled } from 'ts/style/theme';
@@ -142,7 +147,16 @@ export interface CodeDemoProps {
}
export const CodeDemo: React.StatelessComponent<CodeDemoProps> = props => (
- <SyntaxHighlighter language="html" style={customStyle} showLineNumbers={true} PreTag={CustomPre}>
- {props.children}
- </SyntaxHighlighter>
+ <Container position="relative" height="100%">
+ <Container position="absolute" top="10px" right="10px">
+ <CopyToClipboard text={props.children}>
+ <Button fontSize="14px">
+ <b>Copy</b>
+ </Button>
+ </CopyToClipboard>
+ </Container>
+ <SyntaxHighlighter language="html" style={customStyle} showLineNumbers={true} PreTag={CustomPre}>
+ {props.children}
+ </SyntaxHighlighter>
+ </Container>
);