From c0e10b9e13dd6b67e1ef0444dc8ae34b4227dd20 Mon Sep 17 00:00:00 2001 From: Savas Vedova Date: Wed, 4 Dec 2024 18:03:39 +0300 Subject: [PATCH] chore: use mui icon --- src/components/CopyBox/CopyBox.tsx | 43 +++++++++++++++--------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/src/components/CopyBox/CopyBox.tsx b/src/components/CopyBox/CopyBox.tsx index 5727e502..cb8b33ad 100644 --- a/src/components/CopyBox/CopyBox.tsx +++ b/src/components/CopyBox/CopyBox.tsx @@ -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; @@ -25,26 +26,24 @@ export default function CopyBox({ ...InputProps, endAdornment: ( - - - + { + ( + document.querySelector(`#${inputId}`) as HTMLInputElement + ).focus(); + ( + document.querySelector(`#${inputId}`) as HTMLInputElement + ).select(); + document.execCommand("copy"); + setClicked(true); + setTimeout(() => { + setClicked(false); + }, 2000); + }} + > + + ), }}