File size: 763 Bytes
246d201
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import CheckmarkIcon from "#/icons/checkmark.svg?react";
import CopyIcon from "#/icons/copy.svg?react";

interface CopyToClipboardButtonProps {
  isHidden: boolean;
  isDisabled: boolean;
  onClick: () => void;
  mode: "copy" | "copied";
}

export function CopyToClipboardButton({

  isHidden,

  isDisabled,

  onClick,

  mode,

}: CopyToClipboardButtonProps) {
  return (
    <button

      hidden={isHidden}

      disabled={isDisabled}

      data-testid="copy-to-clipboard"

      type="button"

      onClick={onClick}

      className="button-base p-1 absolute top-1 right-1"

    >

      {mode === "copy" && <CopyIcon width={15} height={15} />}

      {mode === "copied" && <CheckmarkIcon width={15} height={15} />}

    </button>
  );
}