'use strict';
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
require("../../stylesheets/attachments/author.scss");
const classnames_1 = __importDefault(require("classnames"));
const React = __importStar(require("react"));
const emoji_1 = __importDefault(require("../../utils/emoji"));
const AuthorLink = ({ href, children }) => (React.createElement("a", { className: "author__link", target: "_blank", href: href, onClick: e => {
        if (!href)
            e.preventDefault();
    } }, children));
const AuthorIcon = ({ icon }) => (React.createElement("span", { className: classnames_1.default('author__image', 'author__image--profile', {
        'author__image--hidden': !icon
    }), style: { backgroundImage: `url(${icon})` } }));
const Author = ({ name, subname, link, icon, caret }) => (React.createElement("div", { className: classnames_1.default('author', { 'author--hidden': !name }) },
    React.createElement("div", { className: "author__wrap" },
        link ? (React.createElement(AuthorLink, { href: link },
            React.createElement(AuthorIcon, { icon: icon }))) : (React.createElement(AuthorIcon, { icon: icon })),
        link ? (React.createElement(AuthorLink, { href: link }, name)) : (React.createElement("span", { dangerouslySetInnerHTML: { __html: emoji_1.default.toImage(name) } })),
        subname && React.createElement("span", { className: "author__spacer" }),
        link ? (React.createElement(AuthorLink, { href: link }, subname)) : (React.createElement("span", { dangerouslySetInnerHTML: { __html: emoji_1.default.toImage(subname) } })),
        ' ',
        caret)));
exports.default = Author;
//# sourceMappingURL=Author.js.map