From 1fd0faf463adf331adb7fe1c01c332ce19a45912 Mon Sep 17 00:00:00 2001 From: josh-wong <23216828+josh-wong@users.noreply.github.com> Date: Sat, 18 May 2024 02:09:18 +0900 Subject: [PATCH 01/22] Create index.tsx --- src/theme/DocItem/Footer/index.tsx | 56 ++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/theme/DocItem/Footer/index.tsx diff --git a/src/theme/DocItem/Footer/index.tsx b/src/theme/DocItem/Footer/index.tsx new file mode 100644 index 00000000..3757d1ca --- /dev/null +++ b/src/theme/DocItem/Footer/index.tsx @@ -0,0 +1,56 @@ +/** + * 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. + */ + +import React from 'react'; +import clsx from 'clsx'; +import {ThemeClassNames} from '@docusaurus/theme-common'; +import {useDoc} from '@docusaurus/theme-common/internal'; +import TagsListInline from '@theme/TagsListInline'; + +import EditMetaRow from '@theme/EditMetaRow'; + +export default function DocItemFooter(): JSX.Element | null { + const {metadata} = useDoc(); + const {editUrl, lastUpdatedAt, lastUpdatedBy, tags} = metadata; + + const canDisplayTagsRow = tags.length > 0; + const canDisplayEditMetaRow = !!(editUrl || lastUpdatedAt || lastUpdatedBy); + + const canDisplayFooter = canDisplayTagsRow || canDisplayEditMetaRow; + + if (!canDisplayFooter) { + return null; + } + + return ( + + ); +} From a8d55cfc528eb858fb03c5f54bd9e66b5b9d56a4 Mon Sep 17 00:00:00 2001 From: josh-wong <23216828+josh-wong@users.noreply.github.com> Date: Sat, 18 May 2024 02:09:57 +0900 Subject: [PATCH 02/22] Comment out tags in footer Since we want to have tags at the top of the page we should hide them from the footer. --- src/theme/DocItem/Footer/index.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/theme/DocItem/Footer/index.tsx b/src/theme/DocItem/Footer/index.tsx index 3757d1ca..33a61d31 100644 --- a/src/theme/DocItem/Footer/index.tsx +++ b/src/theme/DocItem/Footer/index.tsx @@ -29,7 +29,8 @@ export default function DocItemFooter(): JSX.Element | null { return (