Skip to content

Commit

Permalink
chore: use mui icon
Browse files Browse the repository at this point in the history
  • Loading branch information
svedova committed Dec 4, 2024
1 parent 31c8107 commit c0e10b9
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions src/components/CopyBox/CopyBox.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { TextFieldProps } from "@mui/material/TextField";
import { useState } from "react";
import { Tooltip } from "@mui/material";
import Tooltip from "@mui/material/Tooltip";
import TextField from "@mui/material/TextField";
import Button from "~/components/Button";
import IconButton from "@mui/material/IconButton";
import ContentCopyIcon from "@mui/icons-material/ContentCopy";

let id = 0;

Expand All @@ -25,26 +26,24 @@ export default function CopyBox({
...InputProps,
endAdornment: (
<Tooltip open={clicked} title="Copied to clipboard">
<span>
<Button
type="button"
onClick={() => {
(
document.querySelector(`#${inputId}`) as HTMLInputElement
).focus();
(
document.querySelector(`#${inputId}`) as HTMLInputElement
).select();
document.execCommand("copy");
setClicked(true);
setTimeout(() => {
setClicked(false);
}, 2000);
}}
>
<span className="far fa-copy text-white" />
</Button>
</span>
<IconButton
type="button"
onClick={() => {
(
document.querySelector(`#${inputId}`) as HTMLInputElement
).focus();
(
document.querySelector(`#${inputId}`) as HTMLInputElement
).select();
document.execCommand("copy");
setClicked(true);
setTimeout(() => {
setClicked(false);
}, 2000);
}}
>
<ContentCopyIcon sx={{ fontSize: 18 }} />
</IconButton>
</Tooltip>
),
}}
Expand Down

0 comments on commit c0e10b9

Please sign in to comment.