summaryrefslogtreecommitdiffstats
path: root/client/js/app/src/app/pages/querybuilder/Components/Buttons/CopyResponseButton.jsx
blob: de0079a21f9797f7065264bed33c14859d4eddfd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import React, { useContext } from 'react';
import OverlayImageButton from './OverlayImageButton';

import copyImage from '../../assets/img/copy.svg';
import { ResponseContext } from '../Contexts/ResponseContext';

export default function CopyResponseButton() {
  const { response } = useContext(ResponseContext);

  const handleCopy = () => {
    navigator.clipboard.writeText(response);
  };

  return (
    <OverlayImageButton
      className="intro-copy"
      image={copyImage}
      height="30"
      width="30"
      tooltip="Copy"
      onClick={handleCopy}
    />
  );
}