@prokodo/ui
Version:
UI components for production-grade Next.js + Headless CMS (Strapi, Contentful, Headless WordPress) websites by prokodo – built for Core Web Vitals & SEO.
39 lines (38 loc) • 1.28 kB
JavaScript
import { jsxs, jsx } from "react/jsx-runtime";
import { memo } from "react";
import { create } from "../../helpers/bem.js";
import { isString } from "../../helpers/validations.js";
import styles from "./PostItemAuthor.module.scss.js";
import { Avatar } from "../avatar/Avatar.js";
const bem = create(styles, "PostItemAuthor");
const PostItemAuthor = memo(
({ className, avatar, avatarProps, name, nameProps }) => {
const authorName = name;
return /* @__PURE__ */ jsxs("div", { className: bem(void 0, void 0, className), children: [
/* @__PURE__ */ jsx(
Avatar,
{
image: (avatar == null ? void 0 : avatar.src) !== void 0 && isString(avatar == null ? void 0 : avatar.src) ? {
src: avatar == null ? void 0 : avatar.src,
alt: (avatar == null ? void 0 : avatar.alt) ?? ""
} : void 0,
...avatarProps
}
),
/* @__PURE__ */ jsx(
"p",
{
"aria-label": `Author ${authorName}`,
itemProp: "author",
...nameProps,
className: bem("name", void 0, nameProps == null ? void 0 : nameProps.className),
children: authorName
}
)
] });
}
);
PostItemAuthor.displayName = "PostItemAuthor";
export {
PostItemAuthor
};