diff --git a/website/src/components/SidebarAd/index.js b/website/src/components/SidebarAd/index.js index 228e6b97..6aa52c05 100644 --- a/website/src/components/SidebarAd/index.js +++ b/website/src/components/SidebarAd/index.js @@ -24,9 +24,11 @@ function TopResume({className}) { window.gtag('event', 'topresume.sidebar.click'); }}>

+ Best resume service for FAANG +
If you are running low on time, I recommend TopResume's{' '} - resume writing and free resume screening services, which - has helped countless software engineers get interviews at FAANG. + free resume review services, which has helped countless software + engineers get interviews at FAANG.

); @@ -64,9 +66,10 @@ function Educative({className}) { window.gtag('event', 'educative.sidebar.click'); }}>

- Looking to get hired at FAANG? Educative offers - many great courses to improve your interview game.{' '} - Join today for a 10% discount! + Looking to get hired at FAANG? +
+ Educative offers many great courses to improve your interview + game. Join today for a 10% discount!

); diff --git a/website/src/theme/DocItem/index.js b/website/src/theme/DocItem/index.js new file mode 100644 index 00000000..a4013813 --- /dev/null +++ b/website/src/theme/DocItem/index.js @@ -0,0 +1,106 @@ +import React from 'react'; +import clsx from 'clsx'; +import DocPaginator from '@theme/DocPaginator'; +import DocVersionBanner from '@theme/DocVersionBanner'; +import DocVersionBadge from '@theme/DocVersionBadge'; +import Seo from '@theme/Seo'; +import DocItemFooter from '@theme/DocItemFooter'; +import TOC from '@theme/TOC'; +import TOCCollapsible from '@theme/TOCCollapsible'; +import Heading from '@theme/Heading'; +import styles from './styles.module.css'; +import {ThemeClassNames, useWindowSize} from '@docusaurus/theme-common'; +import SidebarAd from '../../components/SidebarAd'; + +export default function DocItem(props) { + const {content: DocContent} = props; + const {metadata, frontMatter} = DocContent; + const { + image, + keywords, + hide_title: hideTitle, + hide_table_of_contents: hideTableOfContents, + toc_min_heading_level: tocMinHeadingLevel, + toc_max_heading_level: tocMaxHeadingLevel, + } = frontMatter; + const {description, title} = metadata; // We only add a title if: + // - user asks to hide it with front matter + // - the markdown content does not already contain a top-level h1 heading + + const shouldAddTitle = + !hideTitle && typeof DocContent.contentTitle === 'undefined'; + const windowSize = useWindowSize(); + const canRenderTOC = + !hideTableOfContents && DocContent.toc && DocContent.toc.length > 0; + // const renderTocDesktop = + // canRenderTOC && (windowSize === 'desktop' || windowSize === 'ssr'); + return ( + <> + + +
+
+ +
+
+ + + {canRenderTOC && ( + + )} + +
+ {/* + Title can be declared inside md content or declared through front matter and added manually + To make both cases consistent, the added title is added under the same div.markdown block + See https://github.com/facebook/docusaurus/pull/4882#issuecomment-853021120 + */} + {shouldAddTitle && ( +
+ {title} +
+ )} + + +
+ + +
+ +
+ +
+
+
+
+ {/* Change it such that sidebar ad is shown regardless whether there's a TOC */} + +
+
+ + ); +} diff --git a/website/src/theme/DocItem/styles.module.css b/website/src/theme/DocItem/styles.module.css new file mode 100644 index 00000000..7828ec62 --- /dev/null +++ b/website/src/theme/DocItem/styles.module.css @@ -0,0 +1,22 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +.docItemContainer header + *, +.docItemContainer article > *:first-child { + margin-top: 0; +} + +@media (min-width: 997px) { + .docItemCol { + max-width: 75% !important; + } + + /* Prevent hydration FOUC, as the mobile TOC needs to be server-rendered */ + .tocMobile { + display: none; + } +} diff --git a/website/src/theme/DocPaginator/index.js b/website/src/theme/DocPaginator/index.js index 48f36d2b..f879b08f 100644 --- a/website/src/theme/DocPaginator/index.js +++ b/website/src/theme/DocPaginator/index.js @@ -6,7 +6,6 @@ */ import React from 'react'; import Translate, {translate} from '@docusaurus/Translate'; -import SidebarAd from '../../components/SidebarAd'; function DocPaginator({previous, next}) { return ( @@ -47,10 +46,6 @@ function DocPaginator({previous, next}) { )} -
- -
- ); }