import React from 'react';
import { useSnackbar } from 'notistack';

import Icon from '../components/Icon';

const toasts: React.FunctionComponent = () => {
  const { enqueueSnackbar, closeSnackbar } = useSnackbar();

  const handleClick = () => {
    enqueueSnackbar('asd111', { 
        variant: 'success',
        action: (key) => (
          <Icon glyph="close" onClick={() => {closeSnackbar(key)}}/>
        ),
    });
  }

  return (
    <button onClick={handleClick}>click</button>
  );
};

export default toasts;
