import CloseIcon from 'mdi-react/CloseIcon';
import * as React from 'react';
/**
 * A global site alert that can be dismissed. Once dismissed, it is never shown
 * again.
 */
export class DismissibleAlert extends React.PureComponent {
    constructor(props) {
        super(props);
        this.onDismiss = () => {
            localStorage.setItem(this.key, 'true');
            this.setState({ dismissed: true });
        };
        this.key = 'DismissibleAlert/' + props.partialStorageKey + '/dismissed';
        this.state = {
            dismissed: localStorage.getItem(this.key) === 'true',
        };
    }
    render() {
        if (this.state.dismissed) {
            return null;
        }
        return (React.createElement("div", { className: `alert dismissible-alert ${this.props.className}` },
            React.createElement("div", { className: "dismissible-alert__content" }, this.props.children),
            React.createElement("button", { className: "btn btn-icon", onClick: this.onDismiss },
                React.createElement(CloseIcon, { className: "icon-inline" }))));
    }
}
//# sourceMappingURL=DismissibleAlert.js.map