import React, { FC } from "react";
import "./SnackBar.css";

interface SnackBarProps {
  message: string;
  show: boolean;
  closeSnackBar: (e: React.MouseEvent<HTMLButtonElement>) => void;
}

const SnackBar: FC<SnackBarProps> = ({ message, show, closeSnackBar }) => (
  <div className={`snackbar${show ? " show" : ""}`}>
    <p>{message}</p>
    <button type="button" onClick={closeSnackBar}>
      閉じる
    </button>
  </div>
);

export default SnackBar;
