import React from 'react';
import styled from 'styled-components';
import { CopyIcon } from '../../assets/icons';
import useCopyToClipboard from '../hooks/useCopyToClipboard';

interface IProps {
  text: string | number;
}

function CopyText(props: IProps) {
  const copy = useCopyToClipboard();

  return (
    <IconContainer onClick={() => copy(props.text)}>
      <CopyIcon fill="#6396e5" />
    </IconContainer>
  );
}

const IconContainer = styled.div`
  cursor: pointer;
`;

export default CopyText;
