-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: mnida <[email protected]> Co-authored-by: Diego Escobedo <[email protected]> Co-authored-by: Hardik Agarwal <[email protected]> Co-authored-by: Hardik Agarwal <[email protected]>
- Loading branch information
1 parent
7848241
commit fa8856e
Showing
17 changed files
with
151 additions
and
324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
.copyText { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
cursor: pointer; | ||
} | ||
|
||
.copiedTag { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
|
||
} | ||
|
||
.text-to-copy { | ||
margin:0 10px 0 5px; | ||
} | ||
|
||
.checkedIcon { | ||
color: white; | ||
border-radius: 5px; | ||
background: green; | ||
margin-right: 6px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// @ts-ignore | ||
import React, {useState} from "react"; | ||
import {CheckCircleOutlined, CopyOutlined} from "@ant-design/icons"; | ||
import "./CopytoClipboard.css"; | ||
import { Tooltip} from "antd"; | ||
|
||
interface CopyTextProps { | ||
textToCopy: string; | ||
className?:string; | ||
showIcon?:boolean; | ||
} | ||
|
||
const CopyText: React.FC<CopyTextProps> = ({textToCopy, className,showIcon}) => { | ||
const [copySuccess, setCopySuccess] = useState(false); | ||
|
||
const copyToClipBoard = async (copyMe) => { | ||
try { | ||
await navigator.clipboard.writeText(copyMe); | ||
setCopySuccess(true); | ||
setTimeout(() => { | ||
setCopySuccess(false); | ||
}, 3000); | ||
} catch (err) { | ||
setCopySuccess(false); | ||
} | ||
}; | ||
|
||
return ( | ||
<div className={`${className} flex`}> | ||
<div className="copyText" onClick={() => copyToClipBoard(textToCopy)}> | ||
<Tooltip | ||
placement="right" | ||
title={copySuccess ? | ||
<div className="copiedTag"> | ||
<CheckCircleOutlined className="checkedIcon"/> Copied | ||
</div> : | ||
<div>Click to Copy <CopyOutlined/></div>} | ||
> | ||
<span className="text-to-copy font-menlo">{textToCopy}</span> | ||
{!!showIcon && <CopyOutlined/>} | ||
</Tooltip> | ||
</div> | ||
</div> | ||
|
||
); | ||
}; | ||
|
||
export default CopyText; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.