analytica-frontend-lib
Version:
Repositório público dos componentes utilizados nas plataformas da Analytica Ensino
56 lines (54 loc) • 2.15 kB
JavaScript
import {
Button_default
} from "./chunk-LAYB7IKW.mjs";
import {
Text_default
} from "./chunk-IMCIR6TJ.mjs";
// src/components/ImagePreviewCard/ImagePreviewCard.tsx
import { PaperclipIcon } from "@phosphor-icons/react/dist/csr/Paperclip";
import { XIcon } from "@phosphor-icons/react/dist/csr/X";
import { jsx, jsxs } from "react/jsx-runtime";
var ImagePreviewCard = ({
imageUrl,
fileName,
onRemove,
onUpdate,
label = "Imagem",
updateButtonLabel = "Atualizar imagem",
removeAriaLabel = "Remover imagem",
className = ""
}) => {
return /* @__PURE__ */ jsxs("div", { className: `flex flex-col gap-4 ${className}`, children: [
label && /* @__PURE__ */ jsx(Text_default, { size: "md", weight: "bold", className: "text-text-950", children: label }),
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-3 border border-border-200 rounded-xl p-4 bg-background", children: [
/* @__PURE__ */ jsx(
"img",
{
src: imageUrl,
alt: fileName,
className: "w-full max-h-80 object-contain rounded-lg"
}
),
/* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center gap-2 border border-border-200 rounded-full px-3 py-1.5 bg-secondary-50 max-w-full min-w-0", children: [
/* @__PURE__ */ jsx(PaperclipIcon, { size: 16, className: "shrink-0 text-text-700" }),
/* @__PURE__ */ jsx(Text_default, { size: "sm", className: "text-text-800 truncate min-w-0", children: fileName }),
onRemove && /* @__PURE__ */ jsx(
"button",
{
type: "button",
onClick: onRemove,
"aria-label": removeAriaLabel,
className: "shrink-0 text-text-700 hover:text-text-950 cursor-pointer",
children: /* @__PURE__ */ jsx(XIcon, { size: 14 })
}
)
] }),
onUpdate && /* @__PURE__ */ jsx(Button_default, { variant: "outline", size: "small", onClick: onUpdate, children: updateButtonLabel })
] })
] });
};
var ImagePreviewCard_default = ImagePreviewCard;
export {
ImagePreviewCard_default
};
//# sourceMappingURL=chunk-RQENM6SM.mjs.map