@plteam/chat-ui
Version:
CUI Kit is a free and open-source library for creating AI assistant chat interfaces, built with React, Material UI, and TypeScript
15 lines (14 loc) • 1.02 kB
JavaScript
import React from 'react';
import Skeleton from '@mui/material/Skeleton';
import 'photoswipe/style.css';
import { useChatSlots } from '../../../views/core/ChatSlotsContext';
const GalleryItem = ({ poster, id, videoUrl, showPlayIcon, className }) => {
const { slots, slotProps } = useChatSlots();
if (!poster) {
return (React.createElement(Skeleton, { variant: 'rounded', sx: { borderRadius: '16px' }, width: "100%", height: "100%" }));
}
return (React.createElement("a", { key: id, href: videoUrl ? videoUrl : poster.src, "data-pswp-width": poster.width, "data-pswp-height": poster.height, "data-pswp-type": videoUrl ? "video" : undefined, "data-pswp-video-src": videoUrl ? videoUrl : undefined, target: "_blank", rel: "noreferrer" },
showPlayIcon ? React.createElement(slots.attachmentVideoPlayIcon, { ...slotProps.attachmentVideoPlayIcon }) : null,
React.createElement("img", { className: className, src: poster.src, alt: "" })));
};
export default GalleryItem;