Close share dialog on copy link

This commit is contained in:
Tom Moor
2018-05-24 21:21:45 -07:00
parent c060a5c798
commit 2c719df32e
2 changed files with 7 additions and 2 deletions

View File

@ -46,7 +46,7 @@ class Modals extends React.Component<Props> {
<CollectionDelete onSubmit={this.handleClose} /> <CollectionDelete onSubmit={this.handleClose} />
</Modal> </Modal>
<Modal name="document-share" title="Share document"> <Modal name="document-share" title="Share document">
<DocumentShare onSubmit={this.handleClose} /> <DocumentShare onCopyLink={this.handleClose} />
</Modal> </Modal>
<Modal name="document-delete" title="Delete document"> <Modal name="document-delete" title="Delete document">
<DocumentDelete onSubmit={this.handleClose} /> <DocumentDelete onSubmit={this.handleClose} />

View File

@ -10,6 +10,7 @@ import Document from 'models/Document';
type Props = { type Props = {
document: Document, document: Document,
onCopyLink: () => *,
}; };
@observer @observer
@ -23,7 +24,11 @@ class DocumentShare extends React.Component<Props> {
handleCopied = () => { handleCopied = () => {
this.isCopied = true; this.isCopied = true;
this.timeout = setTimeout(() => (this.isCopied = false), 3000);
this.timeout = setTimeout(() => {
this.isCopied = false;
this.props.onCopyLink();
}, 2000);
}; };
render() { render() {