import React from "react";
import { Button, Message, Rail } from "semantic-ui-react";
import { useErrorState, useErrorDispatch } from "../stores";
const style = {
    backgroundColor: "mistyrose",
    bottom: 0,
    left: 0,
    position: "fixed",
    right: 0
};
export const ErrorBar = () => {
    const error = useErrorState();
    const { clearError } = useErrorDispatch();
    if (!error) {
        return null;
    }
    return (React.createElement(Message, { error: true, style: style },
        React.createElement(Rail, { position: "right", internal: true, close: true },
            React.createElement(Button, { icon: "close", color: "red", floated: "right", compact: true, onClick: clearError })),
        React.createElement("b", null, error.name),
        React.createElement("p", null, error.message)));
};
