import { j as jsxRuntimeExports } from "../../../../../_virtual/jsx-runtime.js";
import { a as R } from "../../../../sdk/dist/shared/chunk-SQ5T4AT5.js";
import "../../../../sdk/dist/shared/chunk-3YVJ2ELD.js";
import "../../../../sdk/dist/shared/chunk-AFVJZPLS.js";
import "@sinclair/typebox";
import "../../../../sdk/dist/shared/chunk-A3GF4PYW.js";
import "../../../../sdk/dist/shared/chunk-W33JMRRN.js";
import { tx as D } from "../../../../style-system/dist/twind.js";
import { useBrickStyle } from "../hooks/use-brick-style.js";
import { InlineIcon } from "../../../../../node_modules/.pnpm/@iconify_react@6.0.0_react@19.1.1/node_modules/@iconify/react/dist/iconify.js";
import BrickRoot from "../components/BrickRoot.js";
import { useBrickProps } from "../hooks/use-brick-props.js";
import { useState } from "react";
function Testimonials(props) {
  const { brick, editable } = props;
  const brickProps = useBrickProps(props);
  const { colorPreset, border, shadow, ...styles } = useBrickStyle(brick);
  const containerClasses = Object.values(styles);
  const [showImage, setShowImage] = useState(true);
  const testimonials = brickProps.testimonials ?? [];
  const onImageError = (event) => {
    setShowImage(false);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    BrickRoot,
    {
      brick,
      editable,
      manifest: R,
      className: D("flex gap-6 @mobile:flex-col @desktop:flex-row", containerClasses),
      children: testimonials.map((testimonial, index) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
        "div",
        {
          className: D(
            "flex flex-1 flex-col gap-6 p-6 rounded-lg @desktop:(min-w-[250px])",
            colorPreset,
            border,
            shadow
          ),
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              "blockquote",
              {
                className: D(
                  "flex-1 whitespace-pre-wrap text-pretty font-normal italic relative leading-relaxed"
                ),
                children: testimonial.text
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3 flex-nowrap", children: [
              showImage && testimonial.avatar?.src && /* @__PURE__ */ jsxRuntimeExports.jsx(
                "img",
                {
                  src: testimonial.avatar.src,
                  alt: testimonial.avatar.alt || testimonial.author,
                  className: "w-12 h-12 rounded-full object-cover",
                  onError: onImageError
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 flex-nowrap leading-tight", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("cite", { className: D("font-semibold text-[90%] text-nowrap"), children: testimonial.author }),
                testimonial.company && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: D("text-[85%]"), children: testimonial.company })
              ] }),
              testimonial.socialIcon && /* @__PURE__ */ jsxRuntimeExports.jsx(InlineIcon, { icon: testimonial.socialIcon, className: "h-5 w-5" })
            ] })
          ]
        },
        index
      ))
    }
  );
}
export {
  Testimonials as default
};
//# sourceMappingURL=testimonials.js.map
