UNPKG

@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.

24 lines (23 loc) 2.46 kB
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime"; import { ListDisplayMode } from '../../editor/widget-framework/list-display-mode'; import { Pager } from '../pager/pager'; import { getExtension, getFileExtensionCssClass, getFileSize } from './common/utils'; export function DocumentListListView(props) { const items = props.items.Items; return (_jsxs("div", { ...props.attributes, children: [items.map((item, idx) => { const title = item['Title']; const fileSize = getFileSize(item); const extension = getExtension(item); const downloadUrl = item['Url']; const itemUrl = `${props.url}${item.ItemDefaultUrl}${props.queryString}`; const extensionStyle = { backgroundColor: `var(${getFileExtensionCssClass(extension)})` }; return (_jsxs("div", { className: "d-flex gap-3 align-items-center mb-3", children: [_jsxs("div", { className: "position-relative pt-1", 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 text-uppercase ps-1 pe-1 mb-2 text-white small", children: extension })] }), _jsxs("div", { className: "flex-grow-1", children: [title && _jsx(_Fragment, { children: _jsxs("div", { children: [itemUrl && props.renderLinks ? (_jsx("a", { href: itemUrl.toString(), children: title }) // sanitize ) : (title) // sanitize , _jsxs("span", { className: "text-muted small", children: ["(", extension, ")"] })] }) }), _jsxs("div", { children: [_jsx("a", { href: downloadUrl, target: "_blank", className: "text-muted small", children: props.downloadLinkLabel }), _jsxs("span", { className: "text-muted small", children: ["(", fileSize, ")"] })] })] })] }, idx)); }), props.pagerMode === ListDisplayMode.Paging && _jsx("div", { children: _jsx(Pager, { ...props.pagerProps }) })] })); }