-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2896 from ClickHouse/p_issue_201
move edit this page to top
- Loading branch information
Showing
4 changed files
with
90 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
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'; | ||
function TagsRow(props) { | ||
return ( | ||
<div | ||
className={clsx( | ||
ThemeClassNames.docs.docFooterTagsRow, | ||
'row margin-bottom--sm', | ||
)}> | ||
<div className="col"> | ||
<TagsListInline {...props} /> | ||
</div> | ||
</div> | ||
); | ||
} | ||
function EditMetaRow({ | ||
lastUpdatedAt, | ||
lastUpdatedBy, | ||
formattedLastUpdatedAt, | ||
}) { | ||
return ( | ||
<div className={clsx(ThemeClassNames.docs.docFooterEditMetaRow, 'row')}> | ||
<div className={clsx('col', styles.lastUpdated)}> | ||
{(lastUpdatedAt || lastUpdatedBy) && ( | ||
<LastUpdated | ||
lastUpdatedAt={lastUpdatedAt} | ||
formattedLastUpdatedAt={formattedLastUpdatedAt} | ||
lastUpdatedBy={lastUpdatedBy} | ||
/> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
} | ||
export default function DocItemFooter() { | ||
const {metadata} = useDoc(); | ||
const {lastUpdatedAt, formattedLastUpdatedAt, lastUpdatedBy, tags} = | ||
metadata; | ||
const canDisplayTagsRow = tags.length > 0; | ||
const canDisplayEditMetaRow = !!(lastUpdatedAt || lastUpdatedBy); | ||
const canDisplayFooter = canDisplayTagsRow || canDisplayEditMetaRow; | ||
if (!canDisplayFooter) { | ||
return null; | ||
} | ||
return ( | ||
<footer | ||
className={clsx(ThemeClassNames.docs.docFooter, 'docusaurus-mt-lg')}> | ||
{canDisplayTagsRow && <TagsRow tags={tags} />} | ||
{canDisplayEditMetaRow && ( | ||
<EditMetaRow | ||
lastUpdatedAt={lastUpdatedAt} | ||
lastUpdatedBy={lastUpdatedBy} | ||
formattedLastUpdatedAt={formattedLastUpdatedAt} | ||
/> | ||
)} | ||
</footer> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.lastUpdated { | ||
margin-top: 0.2rem; | ||
font-style: italic; | ||
font-size: smaller; | ||
} | ||
|
||
@media (min-width: 997px) { | ||
.lastUpdated { | ||
text-align: right; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters