chore: updates
This commit is contained in:
@@ -12,6 +12,7 @@ const StyledMenu = styled.ul`
|
||||
.item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 14px;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
@@ -23,8 +24,8 @@ const StyledMenu = styled.ul`
|
||||
line-height: 20px;
|
||||
color: #616161;
|
||||
.icon {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
path {
|
||||
fill: #475467;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { useState } from "react";
|
||||
import { copyImageToClipboard } from "copy-image-clipboard";
|
||||
|
||||
const useCopy = () => {
|
||||
const copyToClipboard = (str) => {
|
||||
const el = document.createElement("textarea");
|
||||
@@ -23,13 +25,22 @@ const useCopy = () => {
|
||||
|
||||
const [copied, setCopied] = useState(false);
|
||||
|
||||
const copy = (text) => {
|
||||
const copy = (text, isImage = false) => {
|
||||
let inter = 0;
|
||||
if (!copied) {
|
||||
setCopied(copyToClipboard(text));
|
||||
inter = setTimeout(() => {
|
||||
setCopied(false);
|
||||
}, 500);
|
||||
if (!isImage) {
|
||||
setCopied(copyToClipboard(text));
|
||||
inter = setTimeout(() => {
|
||||
setCopied(false);
|
||||
}, 500);
|
||||
} else {
|
||||
copyImageToClipboard(text).then(() => {
|
||||
setCopied(true);
|
||||
inter = setTimeout(() => {
|
||||
setCopied(false);
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
}
|
||||
return () => {
|
||||
clearTimeout(inter);
|
||||
|
||||
Reference in New Issue
Block a user