"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MessageMetadata = void 0;
var React = require("react");
var classNames = require("classnames");
var FontAwesome = require("react-fontawesome");
var __1 = require("../");
require("./MessageMetadata.less");
function cssClass(element) {
    return "MessageMetadata--" + element;
}
exports.MessageMetadata = React.forwardRef(function (props, ref) {
    var className = props.className, placement = props.placement, readStatusText = props.readStatusText, children = props.children, errorMsg = props.errorMsg;
    return (React.createElement("div", { ref: ref, className: classNames(cssClass("Message--container"), className) },
        React.createElement("div", { className: cssClass("Message--" + placement) }, children),
        readStatusText && React.createElement("div", { className: cssClass("ReadReceipt") }, readStatusText),
        errorMsg && formErrorContainer(errorMsg, placement)));
});
function formErrorContainer(errorMsg, placement) {
    return (React.createElement(__1.FlexBox, { className: classNames(cssClass("Error"), cssClass("Error--" + placement)), grow: true, alignItems: "center" },
        React.createElement("div", { className: cssClass("ErrorContents") },
            React.createElement(FontAwesome, { className: cssClass("Error--Icon"), name: "exclamation-circle " }),
            errorMsg)));
}
