diff options
author | August Skare <post@augustskare.no> | 2018-11-19 16:05:22 +0800 |
---|---|---|
committer | August Skare <post@augustskare.no> | 2018-11-19 16:05:22 +0800 |
commit | cd333e097714693f81f72693cbd351f09939052b (patch) | |
tree | cc23f633af02131fb129101bc340432223ecb4f8 /packages/dev-tools-pages | |
parent | 62706d83c404efc55b076900be8e2b0150f9b470 (diff) | |
download | dexon-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')
-rw-r--r-- | packages/dev-tools-pages/ts/components/Code.tsx | 10 |
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 }); } }; } |