import { useNavigate } from 'react-router-dom';
import { IconButton } from '@mui/material';
import { Back } from '../icons/icons';

export const BackButton = ({ to }) => {
  const navigate = useNavigate();

  const handleBack = () => {
    navigate(to);
  };

  return (
    <IconButton color="grey" shape="rounded" onClick={handleBack}>
      <Back />
    </IconButton>
  );
};
