aboutsummaryrefslogtreecommitdiffstats
path: root/packages/dev-tools-pages
diff options
context:
space:
mode:
Diffstat (limited to 'packages/dev-tools-pages')
-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 });
}
};
}