aboutsummaryrefslogtreecommitdiffstats
path: root/packages/dev-tools-pages/ts/components
diff options
context:
space:
mode:
authorAugust Skare <post@augustskare.no>2018-11-19 16:05:22 +0800
committerAugust Skare <post@augustskare.no>2018-11-19 16:05:22 +0800
commitcd333e097714693f81f72693cbd351f09939052b (patch)
treecc23f633af02131fb129101bc340432223ecb4f8 /packages/dev-tools-pages/ts/components
parent62706d83c404efc55b076900be8e2b0150f9b470 (diff)
downloaddexon-sol-tools-cd333e097714693f81f72693cbd351f09939052b.tar
dexon-sol-tools-cd333e097714693f81f72693cbd351f09939052b.tar.gz
dexon-sol-tools-cd333e097714693f81f72693cbd351f09939052b.tar.bz2
dexon-sol-tools-cd333e097714693f81f72693cbd351f09939052b.tar.lz
dexon-sol-tools-cd333e097714693f81f72693cbd351f09939052b.tar.xz
dexon-sol-tools-cd333e097714693f81f72693cbd351f09939052b.tar.zst
dexon-sol-tools-cd333e097714693f81f72693cbd351f09939052b.zip
rename copied to didCopy in Code state
Diffstat (limited to 'packages/dev-tools-pages/ts/components')
-rw-r--r--packages/dev-tools-pages/ts/components/Code.tsx10
1 files changed, 5 insertions, 5 deletions
diff --git a/packages/dev-tools-pages/ts/components/Code.tsx b/packages/dev-tools-pages/ts/components/Code.tsx
index 1ddedb112..71555b84d 100644
--- a/packages/dev-tools-pages/ts/components/Code.tsx
+++ b/packages/dev-tools-pages/ts/components/Code.tsx
@@ -24,7 +24,7 @@ interface CodeProps {
interface CodeState {
hlCode?: string;
- copied?: boolean;
+ didCopy?: boolean;
}
const Button = styled(BaseButton)`
@@ -170,7 +170,7 @@ class Code extends React.Component<CodeProps, CodeState> {
) : null}
</Base>
{navigator.userAgent !== 'ReactSnap' && canCopy ? (
- <Button onClick={this._handleCopyAsync}>{this.state.copied ? 'Copied' : 'Copy'}</Button>
+ <Button onClick={this._handleCopyAsync}>{this.state.didCopy ? 'Copied' : 'Copy'}</Button>
) : null}
</Container>
);
@@ -194,17 +194,17 @@ class Code extends React.Component<CodeProps, CodeState> {
try {
if ('clipboard' in navigator) {
await (navigator as any).clipboard.writeText(this.props.children);
- this.setState({ copied: true });
+ this.setState({ didCopy: true });
} else {
const lastActive = document.activeElement as HTMLElement;
this._code.current.focus();
this._code.current.select();
document.execCommand('copy');
lastActive.focus();
- this.setState({ copied: true });
+ this.setState({ didCopy: true });
}
} catch (error) {
- this.setState({ copied: false });
+ this.setState({ didCopy: false });
}
};
}