UNPKG

undeexcepturi

Version:

TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.

77 lines (74 loc) 2.49 kB
import React from 'react'; import clsx from 'clsx'; import { useWindowSize, useColorMode } from '@docusaurus/theme-common'; import { useDoc } from '@docusaurus/theme-common/internal'; import DocItemPaginator from '@theme/DocItem/Paginator'; import DocVersionBanner from '@theme/DocVersionBanner'; import DocVersionBadge from '@theme/DocVersionBadge'; import DocItemFooter from '@theme/DocItem/Footer'; import DocItemTOCMobile from '@theme/DocItem/TOC/Mobile'; import DocItemTOCDesktop from '@theme/DocItem/TOC/Desktop'; import DocItemContent from '@theme/DocItem/Content'; import DocBreadcrumbs from '@theme/DocBreadcrumbs'; import Unlisted from '@theme/Unlisted'; import Giscus from '@giscus/react'; import styles from './styles.module.css'; /** * Decide if the toc should be rendered, on mobile or desktop viewports */ function useDocTOC() { const { frontMatter, toc } = useDoc(); const windowSize = useWindowSize(); const hidden = frontMatter.hide_table_of_contents; const canRender = !hidden && toc.length > 0; const mobile = canRender ? <DocItemTOCMobile /> : undefined; const desktop = canRender && (windowSize === 'desktop' || windowSize === 'ssr') ? ( <DocItemTOCDesktop /> ) : undefined; return { hidden, mobile, desktop, }; } export default function DocItemLayout({ children }) { const docTOC = useDocTOC(); const { colorMode } = useColorMode(); const { metadata: { unlisted }, } = useDoc(); return ( <div className='row'> <div className={clsx('col', !docTOC.hidden && styles.docItemCol)}> {unlisted && <Unlisted />} <DocVersionBanner /> <div className={styles.docItemContainer}> <article> <DocBreadcrumbs /> <DocVersionBadge /> {docTOC.mobile} <DocItemContent>{children}</DocItemContent> <DocItemFooter /> </article> <DocItemPaginator /> <Giscus id="giscus-comments" repo="mikro-orm/mikro-orm" repoId="MDEwOlJlcG9zaXRvcnkxMjUzNDIwNjQ=" category="Comments" categoryId="DIC_kwDOB3iRcM4CcQyL" mapping="pathname" reactionsEnabled="1" emitMetadata="0" inputPosition="top" theme={colorMode} lang="en" strict="1" /> </div> </div> {docTOC.desktop && <div className='col col--3'>{docTOC.desktop}</div>} </div> ); }