UNPKG

@udus/notion-renderer

Version:
15 lines (14 loc) 1.43 kB
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime"; import { selectProperties, splitTitleAndOtherProperties, } from "../../utils/index.js"; import { BlockList } from "../Blocks/BlockList.js"; import { Cover } from "../Common/Cover.js"; import { Icon } from "../Common/Icon.js"; import { Title } from "../Common/Title.js"; import { Properties } from "../Property/Properties.js"; export const Page = ({ page, blocks, displayProperties, hideCover = false, hideIcon = false, hideTitle = false, hideProperties = false, }) => { const { title, other } = splitTitleAndOtherProperties(page.properties); const properties = displayProperties ? selectProperties(other, displayProperties) : other; return (_jsxs("div", { id: page.id, className: "notion-page", children: [!hideCover && (_jsx("div", { className: "notion-page-cover", children: _jsx(Cover, { cover: page.cover }) })), !hideIcon && (_jsx("div", { className: "notion-page-icon", children: _jsx(Icon, { icon: page.icon }) })), !hideTitle && (_jsx("div", { className: "notion-page-title", children: _jsx(Title, { title: title?.title ?? [] }) })), !hideProperties && (_jsx("div", { className: "notion-page-properties", children: _jsx(Properties, { properties: properties }) })), blocks && (_jsxs(_Fragment, { children: [_jsx("hr", { className: "notion-page-divider" }), _jsx(BlockList, { blocks: blocks })] }))] })); };