From bbefdc4bf03c887f3ea122090070ea8b5c8b989f Mon Sep 17 00:00:00 2001 From: Yangshun Tay Date: Sat, 9 Jul 2022 10:24:31 +0800 Subject: [PATCH] website: upgrade to docusaurus@2.0.0-rc-1 --- website/package.json | 6 +- .../components/SidebarAd/styles.module.css | 10 +- website/src/css/custom.css | 17 - website/src/theme/DocItem/Content/index.js | 47 + website/src/theme/DocItem/Layout/index.js | 59 + .../theme/DocItem/Layout/styles.module.css | 17 + website/src/theme/DocItem/index.js | 138 - website/src/theme/DocItem/styles.module.css | 27 - website/src/theme/DocPaginator/index.js | 39 - .../src/theme/DocSidebar/Mobile/index.d.ts | 5 + website/src/theme/DocSidebar/Mobile/index.js | 9 +- website/src/theme/DocSidebarItem/index.js | 265 -- .../theme/DocSidebarItem/styles.module.css | 17 - website/src/theme/PaginatorNavLink/index.js | 17 - .../theme/PaginatorNavLink/styles.module.css | 13 - website/yarn.lock | 2262 ++++++++--------- 16 files changed, 1262 insertions(+), 1686 deletions(-) create mode 100644 website/src/theme/DocItem/Content/index.js create mode 100644 website/src/theme/DocItem/Layout/index.js create mode 100644 website/src/theme/DocItem/Layout/styles.module.css delete mode 100644 website/src/theme/DocItem/index.js delete mode 100644 website/src/theme/DocItem/styles.module.css delete mode 100644 website/src/theme/DocPaginator/index.js create mode 100644 website/src/theme/DocSidebar/Mobile/index.d.ts delete mode 100644 website/src/theme/DocSidebarItem/index.js delete mode 100644 website/src/theme/DocSidebarItem/styles.module.css delete mode 100644 website/src/theme/PaginatorNavLink/index.js delete mode 100644 website/src/theme/PaginatorNavLink/styles.module.css diff --git a/website/package.json b/website/package.json index 2065de3d..ceb5712a 100755 --- a/website/package.json +++ b/website/package.json @@ -11,9 +11,9 @@ "deploy": "docusaurus deploy" }, "dependencies": { - "@docusaurus/core": "^2.0.0-beta.21", - "@docusaurus/plugin-client-redirects": "^2.0.0-beta.21", - "@docusaurus/preset-classic": "^2.0.0-beta.21", + "@docusaurus/core": "^2.0.0-rc.1", + "@docusaurus/plugin-client-redirects": "^2.0.0-rc.1", + "@docusaurus/preset-classic": "^2.0.0-rc.1", "classnames": "^2.2.6", "react": "^17.0.2", "react-dom": "^17.0.2" diff --git a/website/src/components/SidebarAd/styles.module.css b/website/src/components/SidebarAd/styles.module.css index 8baa5452..c3b42cdc 100644 --- a/website/src/components/SidebarAd/styles.module.css +++ b/website/src/components/SidebarAd/styles.module.css @@ -11,7 +11,7 @@ } .container:hover { - color: #fff; + color: #fff !important; opacity: 1; text-decoration: none; } @@ -22,11 +22,11 @@ .backgroundGrokkingCoding { background-color: #6fc8cc; - color: #083436; + color: #083436 !important; } .backgroundGrokkingCoding:hover { - color: #083436; + color: #083436 !important; } .backgroundGrokkingSystemDesign { @@ -43,11 +43,11 @@ .backgroundInterviewingio { background-color: #ffd829; - color: rgb(10, 10, 10); + color: rgb(10, 10, 10) !important; } .backgroundInterviewingio:hover { - color: rgb(10, 10, 10); + color: rgb(10, 10, 10) !important; } .backgroundByteByteGo { diff --git a/website/src/css/custom.css b/website/src/css/custom.css index cfd42d00..ee36df30 100755 --- a/website/src/css/custom.css +++ b/website/src/css/custom.css @@ -147,19 +147,6 @@ div[class^='announcementBar_'] { margin-bottom: 0 !important; } -.docs-doc-page .pagination-nav__item:first-child .pagination-nav__label::before, -.docs-doc-page .pagination-nav__item--next .pagination-nav__label::after { - content: ''; -} - -.pagination-nav__item .pagination-nav__label { - font-size: 1.5rem; -} - -.docs-doc-page .pagination-nav__item { - max-width: 100%; -} - .navbar-icon:before { background-repeat: no-repeat; content: ''; @@ -233,7 +220,3 @@ html[data-theme='dark'] .navbar-icon-discord:before { .admonition-heading h5 { margin-top: 0; } - -.pagination-nav { - grid-template-columns: repeat(1, 1fr); -} diff --git a/website/src/theme/DocItem/Content/index.js b/website/src/theme/DocItem/Content/index.js new file mode 100644 index 00000000..55bb61b0 --- /dev/null +++ b/website/src/theme/DocItem/Content/index.js @@ -0,0 +1,47 @@ +import React from 'react'; +import clsx from 'clsx'; +import {ThemeClassNames} from '@docusaurus/theme-common'; +import {useDoc} from '@docusaurus/theme-common/internal'; +import Heading from '@theme/Heading'; +import MDXContent from '@theme/MDXContent'; +/** + 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 + + We render a "synthetic title" if: + - user doesn't ask to hide it with front matter + - the markdown content does not already contain a top-level h1 heading +*/ +function useSyntheticTitle() { + const {metadata, frontMatter, contentTitle} = useDoc(); + const shouldRender = + !frontMatter.hide_title && typeof contentTitle === 'undefined'; + if (!shouldRender) { + return null; + } + return metadata.title; +} +export default function DocItemContent({children}) { + const syntheticTitle = useSyntheticTitle(); + return ( +
+ {syntheticTitle && ( +
+ {syntheticTitle} +
+ )} +
+