@progress/sitefinity-nextjs-sdk
Version:
Provides OOB widgets developed using the Next.js framework, which includes an abstraction layer for Sitefinity communication. Additionally, it offers an expanded API, typings, and tools for further development and integration.
21 lines (20 loc) • 2.09 kB
JavaScript
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
import { formatDate } from '../common/utils';
import { getExtension, getFileExtensionCssClass, getFileSize } from './common/utils';
export function DocumentDetailItemView(props) {
const sdkItem = props.item;
const title = sdkItem['Title'];
const author = sdkItem['Author'];
const publicationDate = sdkItem['PublicationDate'] ? new Date(sdkItem['PublicationDate']) : '';
const description = sdkItem['Description'];
const fileSize = getFileSize(sdkItem);
const extension = getExtension(sdkItem);
const downloadUrl = sdkItem['Url'];
const extensionStyle = {
backgroundColor: `var(${getFileExtensionCssClass(extension)})`
};
return (_jsxs("div", { ...props.attributes, children: [_jsxs("h1", { children: [title, " "] }), _jsxs("div", { className: "text-muted", children: [sdkItem['PublicationDate'] && formatDate(publicationDate, props.culture), author ? author : null // sanitize
] }), description &&
_jsx("div", { className: "mt-3", children: description // sanitize
}), _jsxs("div", { className: "d-flex gap-3 align-items-center mt-3", children: [_jsxs("div", { className: "position-relative", children: [_jsx("svg", { xmlns: "https://www.w3.org/2000/svg", width: "36", viewBox: "0 0 384 512", fill: "#a7acb1", children: _jsx("path", { d: "M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm160-14.1v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z" }) }), _jsx("span", { style: extensionStyle, className: "sc-file-icon-extension sc-fs-0625rem text-uppercase ps-1 pe-1 mb-2 text-white", children: extension })] }), _jsxs("div", { className: "flex-grow-1", children: [_jsxs("div", { children: [_jsx("a", { href: downloadUrl, target: "_blank", children: props.downloadLinkLabel }), _jsxs("span", { className: "text-muted small", children: ["(", extension, ")"] })] }), _jsx("span", { className: "text-muted small", children: fileSize })] })] })] }));
}