@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.
36 lines (35 loc) • 1.08 kB
JavaScript
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
import { jsxs, jsx } from "react/jsx-runtime";
import { create } from "../../helpers/bem.js";
import { isString } from "../../helpers/validations.js";
import styles from "./Image.module.scss.js";
const bem = create(styles, "Image");
const Image = /* @__PURE__ */ __name(({
alt,
caption,
containerClassName,
captionClassName,
className,
imageComponent: CustomImage = "img",
...props
}) => {
const renderImage = /* @__PURE__ */ __name(() => /* @__PURE__ */ jsx(
CustomImage,
{
alt: alt ?? "",
className: bem("image", void 0, className),
...props
}
), "renderImage");
if (isString(caption)) {
return /* @__PURE__ */ jsxs("figure", { className: bem(void 0, void 0, containerClassName), children: [
renderImage(),
/* @__PURE__ */ jsx("figcaption", { className: bem("caption", void 0, captionClassName), children: caption })
] });
}
return renderImage();
}, "Image");
export {
Image
};