From f042dca61acf8b5c06157752e787f6c6a704caf3 Mon Sep 17 00:00:00 2001 From: Bartosz Kaszubowski Date: Wed, 12 Oct 2022 20:50:17 +0200 Subject: [PATCH] add back missing docs vote component (#3371) --- website/src/theme/DocItem/Footer/index.js | 75 +++++++++++++++++++ .../theme/DocItem/Footer/styles.module.css | 11 +++ website/src/theme/DocItemFooter/index.js | 18 ----- 3 files changed, 86 insertions(+), 18 deletions(-) create mode 100644 website/src/theme/DocItem/Footer/index.js create mode 100644 website/src/theme/DocItem/Footer/styles.module.css delete mode 100644 website/src/theme/DocItemFooter/index.js diff --git a/website/src/theme/DocItem/Footer/index.js b/website/src/theme/DocItem/Footer/index.js new file mode 100644 index 00000000000..290320f09fc --- /dev/null +++ b/website/src/theme/DocItem/Footer/index.js @@ -0,0 +1,75 @@ +import React from 'react'; +import clsx from 'clsx'; +import {ThemeClassNames} from '@docusaurus/theme-common'; +import {useDoc} from '@docusaurus/theme-common/internal'; +import LastUpdated from '@theme/LastUpdated'; +import EditThisPage from '@theme/EditThisPage'; +import TagsListInline from '@theme/TagsListInline'; + +import styles from './styles.module.css'; +import DocsRating from '../../../../core/DocsRating'; + +function TagsRow(props) { + return ( +
+
+ +
+
+ ); +} +function EditMetaRow({ + editUrl, + lastUpdatedAt, + lastUpdatedBy, + formattedLastUpdatedAt, +}) { + return ( +
+
{editUrl && }
+ +
+ {(lastUpdatedAt || lastUpdatedBy) && ( + + )} +
+
+ ); +} +export default function DocItemFooter() { + const {metadata} = useDoc(); + const {editUrl, lastUpdatedAt, formattedLastUpdatedAt, lastUpdatedBy, tags} = + metadata; + const canDisplayTagsRow = tags.length > 0; + const canDisplayEditMetaRow = !!(editUrl || lastUpdatedAt || lastUpdatedBy); + const canDisplayFooter = canDisplayTagsRow || canDisplayEditMetaRow; + if (!canDisplayFooter) { + return null; + } + + return ( + <> + +
+ {canDisplayTagsRow && } + {canDisplayEditMetaRow && ( + + )} +
+ + ); +} diff --git a/website/src/theme/DocItem/Footer/styles.module.css b/website/src/theme/DocItem/Footer/styles.module.css new file mode 100644 index 00000000000..7c1e9644191 --- /dev/null +++ b/website/src/theme/DocItem/Footer/styles.module.css @@ -0,0 +1,11 @@ +.lastUpdated { + margin-top: 0.2rem; + font-style: italic; + font-size: smaller; +} + +@media (min-width: 997px) { + .lastUpdated { + text-align: right; + } +} diff --git a/website/src/theme/DocItemFooter/index.js b/website/src/theme/DocItemFooter/index.js deleted file mode 100644 index df37518a258..00000000000 --- a/website/src/theme/DocItemFooter/index.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and 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 DocItemFooterOriginal from '@theme-original/DocItemFooter'; -import DocsRating from '../../../core/DocsRating'; - -export default function DocItemFooter(props) { - return ( - <> - - - - ); -}