-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display warning when reading old documentation (#337)
* Display notice when reading old docs * Fix version order
- Loading branch information
Showing
5 changed files
with
59 additions
and
8 deletions.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,4 +125,4 @@ | |
.faucetPlantContainer { | ||
margin-bottom: 0; | ||
} | ||
} | ||
} |
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,40 @@ | ||
import React from 'react'; | ||
import { | ||
useActiveDocContext, | ||
useVersions, | ||
useLatestVersion, | ||
useActiveVersion, | ||
} from '@docusaurus/plugin-content-docs/client'; | ||
import DocsVersionDropdownNavbarItem from '@theme-original/NavbarItem/DocsVersionDropdownNavbarItem'; | ||
|
||
|
||
export default function DocsVersionDropdownNavbarItemWrapper(props) { | ||
const activeDocContext = useActiveDocContext(props.docsPluginId); | ||
const versions = useVersions(props.docsPluginId); | ||
const currentVersion = versions.find( | ||
(version) => version.name === 'current', | ||
); | ||
const isViewingOutdatedVersion = activeDocContext.activeVersion.name !== currentVersion.name; | ||
const d = "M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224c0-17.7-14.3-32-32-32s-32 14.3-32 32s14.3 32 32 32s32-14.3 32-32z"; | ||
|
||
if (isViewingOutdatedVersion) { | ||
return ( | ||
<> | ||
<div className={"navbar__item oldVersion"}> | ||
<div className={"attention"}> | ||
<svg xmlns={"http://www.w3.org/2000/svg"} viewBox={"0 0 512 512"}><path d={d}></path></svg> | ||
Check failure on line 25 in src/theme/NavbarItem/DocsVersionDropdownNavbarItem.js GitHub Actions / gh-release
|
||
</div> | ||
You are viewing the documentation for an older version of ink!. | ||
</div> | ||
<DocsVersionDropdownNavbarItem {...props} /> | ||
</> | ||
); | ||
} else { | ||
return ( | ||
<> | ||
<DocsVersionDropdownNavbarItem {...props} /> | ||
</> | ||
); | ||
|
||
} | ||
} |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[ | ||
"3.x", | ||
"4.x" | ||
"4.x", | ||
"3.x" | ||
] |