diff --git a/docusaurus.config.js b/docusaurus.config.js index cdf85fbb36..4f6e9d7c20 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -84,16 +84,16 @@ module.exports = { path: '', banner: 'none', }, - '3.x': { - label: '3.x', - path: '3.x', - banner: 'none', - }, '4.x': { label: '4.x', path: '4.x', banner: 'none', }, + '3.x': { + label: '3.x', + path: '3.x', + banner: 'none', + }, }, }, blog: { diff --git a/src/css/custom.css b/src/css/custom.css index d2cd759bde..d68c629198 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -321,3 +321,14 @@ features display: initial; } } + +.oldVersion { + color: var(--ifm-color-primary); +} + +.attention { + float: left; + width: 15px; + color: var(--ifm-color-primary); + fill: var(--ifm-color-primary); +} diff --git a/src/css/faucet.css b/src/css/faucet.css index 177b2484c5..1fe712e6ed 100644 --- a/src/css/faucet.css +++ b/src/css/faucet.css @@ -125,4 +125,4 @@ .faucetPlantContainer { margin-bottom: 0; } -} +} \ No newline at end of file diff --git a/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.js b/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.js new file mode 100644 index 0000000000..33f73f4758 --- /dev/null +++ b/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.js @@ -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 ( + <> +
+
+ +
+ You are viewing the documentation for an older version of ink!. +
+ + + ); + } else { + return ( + <> + + + ); + + } +} diff --git a/versions.json b/versions.json index 7bdae8aa87..53da81a3ae 100644 --- a/versions.json +++ b/versions.json @@ -1,4 +1,4 @@ [ - "3.x", - "4.x" + "4.x", + "3.x" ]