aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAugust Skare <post@augustskare.no>2018-10-30 15:27:31 +0800
committerAugust Skare <post@augustskare.no>2018-10-30 15:27:31 +0800
commit5cb944fe1b92c1d9f886faa247297115abbfd463 (patch)
treeba83077cd84a2316da87ca7ca8696b111e14806e
parent50c4909f2249c3c73675ba8d13122bd520394363 (diff)
downloaddexon-sol-tools-5cb944fe1b92c1d9f886faa247297115abbfd463.tar
dexon-sol-tools-5cb944fe1b92c1d9f886faa247297115abbfd463.tar.gz
dexon-sol-tools-5cb944fe1b92c1d9f886faa247297115abbfd463.tar.bz2
dexon-sol-tools-5cb944fe1b92c1d9f886faa247297115abbfd463.tar.lz
dexon-sol-tools-5cb944fe1b92c1d9f886faa247297115abbfd463.tar.xz
dexon-sol-tools-5cb944fe1b92c1d9f886faa247297115abbfd463.tar.zst
dexon-sol-tools-5cb944fe1b92c1d9f886faa247297115abbfd463.zip
optional copy button in code component
-rw-r--r--packages/dev-tools-pages/ts/components/Code.tsx7
-rw-r--r--packages/dev-tools-pages/ts/pages/Compiler.tsx2
2 files changed, 6 insertions, 3 deletions
diff --git a/packages/dev-tools-pages/ts/components/Code.tsx b/packages/dev-tools-pages/ts/components/Code.tsx
index d1aeaeeb0..a6971fc84 100644
--- a/packages/dev-tools-pages/ts/components/Code.tsx
+++ b/packages/dev-tools-pages/ts/components/Code.tsx
@@ -17,6 +17,7 @@ interface CodeProps {
diff?: boolean;
gutter?: Array<number>;
gutterLength?: number;
+ copy?: boolean;
}
interface CodeState {
@@ -163,7 +164,7 @@ class Code extends React.Component<CodeProps, CodeState> {
};
render() {
- const { language, light, diff, children, gutterLength } = this.props;
+ const { language, light, diff, children, gutterLength, copy } = this.props;
const { hlCode } = this.state;
let Code = 'code';
@@ -185,7 +186,9 @@ class Code extends React.Component<CodeProps, CodeState> {
<CopyInput readOnly aria-hidden="true" ref={this.code} value={children} />
) : null}
</Base>
- {navigator.userAgent !== 'ReactSnap' ? <Button onClick={this.handleCopy}>{this.state.copied ? 'Copied' : 'Copy'}</Button> : null}
+ {navigator.userAgent !== 'ReactSnap' && copy ? (
+ <Button onClick={this.handleCopy}>{this.state.copied ? 'Copied' : 'Copy'}</Button>
+ ) : null}
</Container>
);
}
diff --git a/packages/dev-tools-pages/ts/pages/Compiler.tsx b/packages/dev-tools-pages/ts/pages/Compiler.tsx
index d2c14c90c..2cb232c8c 100644
--- a/packages/dev-tools-pages/ts/pages/Compiler.tsx
+++ b/packages/dev-tools-pages/ts/pages/Compiler.tsx
@@ -19,7 +19,7 @@ function Compiler() {
<ContentBlock main title="Get started" />
<ContentBlock title="Install">
<Breakout>
- <Code>npm install @0x/sol-compiler --g</Code>
+ <Code copy>npm install @0x/sol-compiler --g</Code>
</Breakout>
</ContentBlock>