From 22b606290086bab4967e68baa0191c329161e090 Mon Sep 17 00:00:00 2001 From: Ju4tCode <42488585+yanyongyu@users.noreply.github.com> Date: Wed, 13 Sep 2023 13:55:48 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20Docs:=20=E6=B7=BB=E5=8A=A0=20wwads?= =?UTF-8?q?=20(#2361)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- website/docusaurus.config.js | 9 +++++ website/src/theme/FooterCopyright/index.tsx | 6 +-- website/src/theme/TOC/index.tsx | 27 ++++++++++++++ website/src/theme/TOC/styles.module.css | 41 +++++++++++++++++++++ 4 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 website/src/theme/TOC/index.tsx create mode 100644 website/src/theme/TOC/styles.module.css diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index c7120c2e..a90d54cf 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -23,6 +23,15 @@ const config = { }, }, + scripts: [ + { + type: "text/javascript", + charset: "UTF-8", + src: "https://cdn.wwads.cn/js/makemoney.js", + async: true, + }, + ], + presets: [ [ "docusaurus-preset-nonepress", diff --git a/website/src/theme/FooterCopyright/index.tsx b/website/src/theme/FooterCopyright/index.tsx index a7b334ae..1cfb65bd 100644 --- a/website/src/theme/FooterCopyright/index.tsx +++ b/website/src/theme/FooterCopyright/index.tsx @@ -3,7 +3,7 @@ import React from "react"; import Link from "@docusaurus/Link"; import OriginCopyright from "@theme-original/FooterCopyright"; -function FooterCopyright() { +export default function FooterCopyright(): JSX.Element { return ( <> @@ -24,7 +24,7 @@ function FooterCopyright() { fill="none" xmlns="http://www.w3.org/2000/svg" > - + ); } - -export default FooterCopyright; diff --git a/website/src/theme/TOC/index.tsx b/website/src/theme/TOC/index.tsx new file mode 100644 index 00000000..743967dc --- /dev/null +++ b/website/src/theme/TOC/index.tsx @@ -0,0 +1,27 @@ +import React from "react"; +import clsx from "clsx"; + +import TOCItems from "@theme/TOCItems"; +import styles from "./styles.module.css"; +import type { TOCProps } from "@theme/TOC"; + +const LINK_CLASS_NAME = styles["toc-link"]; +const LINK_ACTIVE_CLASS_NAME = styles["toc-link-active"]; + +export default function TOC({ className, ...props }: TOCProps): JSX.Element { + return ( +
+ +
+
+
+
+ ); +} diff --git a/website/src/theme/TOC/styles.module.css b/website/src/theme/TOC/styles.module.css new file mode 100644 index 00000000..27f15aaa --- /dev/null +++ b/website/src/theme/TOC/styles.module.css @@ -0,0 +1,41 @@ +.toc { + max-height: calc(100vh - 7rem); + + @apply sticky top-28 overflow-y-auto; +} + +.toc-link { + @apply text-light-text; +} + +:global .dark :local .toc-link { + @apply text-dark-text; +} + +.toc-link-active { + @apply text-light-text-active; +} + +:global .dark :local .toc-link-active { + @apply text-dark-text-active; +} + +.tocAdsContainer { + @apply sticky bottom-0 w-full max-w-full mt-2; +} + +.tocAds { + @apply max-w-full !bg-light; +} + +:global .dark :local .tocAds { + @apply !bg-dark; +} + +.tocAds :global .wwads-text { + @apply text-light-text; +} + +:global .dark :local .tocAds :global .wwads-text { + @apply text-dark-text; +}