import { cssTransition, ToastContainer } from 'react-toastify';
import styled from 'styled-components';

const StyledSnackBar = styled(ToastContainer)`
  // https://styled-components.com/docs/faqs#how-can-i-override-styles-with-higher-specificity
  &&&.Toastify__toast-container {
    display: flex;
    align-items: center;
    justify-content: center;
    bottom: 30px;
    pointer-events: none;
    margin-bottom: calc(env(safe-area-inset-top) / 3);
    z-index: 1000;
  }
  .Toastify__toast {
    pointer-events: none;
    calc(100% - 32px);
    height: auto;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: auto;
    border-radius: 50px;
    padding: 10px 20px;
    background-color: rgba(45, 52, 54, 0.8);
    width: 85%;
    color: #ffffff
  }
  .Toastify__toast-body {
    padding: 0;
    margin: 0;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .Toastify__toast-body > div:last-child {
    color: #fff;
    line-height: 20px;
    font-size: 14px;
  }
  .Toastify__progress-bar {
  }
`;

export const SnackBar = () => {
  const fade = cssTransition({
    enter: 'animate__animated animate__fadeIn animate__faster',
    exit: 'animate__animated animate__fadeOut animate__faster',
  });

  return (
    <StyledSnackBar
      position="bottom-center"
      autoClose={3000}
      limit={1}
      hideProgressBar
      newestOnTop={false}
      closeOnClick={false}
      rtl={false}
      pauseOnFocusLoss={false}
      draggable={false}
      pauseOnHover={false}
      containerId={'snackbar'}
      draggablePercent={10}
      closeButton={false}
    />
  );
};
