@udus/notion-renderer
Version:

12 lines (11 loc) • 714 B
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
export const File = ({ file }) => {
const fileUrl = file.type == "external"
? file.external.url
: file.type == "file"
? file.file.url
: "";
const filename = file.name ??
decodeURIComponent(new URL(fileUrl).pathname.split("/").slice(-1)[0]);
return (_jsx("a", { href: fileUrl, className: "notion-file", children: _jsxs("span", { className: "notion-file-title", children: [_jsx("span", { className: "notion-file-icon", children: _jsx("img", { src: "https://www.notion.so/icons/document_gray.svg", alt: "" }) }), _jsx("span", { className: "notion-file-name", children: filename })] }) }));
};