Skip to content

Commit

Permalink
[docs] Allows to access the next MUI-X (#34798)
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandre Fauquette <45398769+alexfauquette@users.noreply.github.com>
Co-authored-by: Lukas <llukas.tyla@gmail.com>
  • Loading branch information
alexfauquette and LukasTy committed Nov 14, 2022
1 parent 75f5a8a commit 55d2254
Showing 1 changed file with 47 additions and 3 deletions.
50 changes: 47 additions & 3 deletions docs/src/modules/components/AppNavDrawer.js
Expand Up @@ -300,6 +300,8 @@ export default function AppNavDrawer(props) {
if (!versions?.length) {
return null;
}

const currentVersion = versions.find((version) => version.current) || versions[0];
return (
<React.Fragment>
<Button
Expand Down Expand Up @@ -331,7 +333,7 @@ export default function AppNavDrawer(props) {
...(Array.isArray(sx) ? sx : [sx]),
]}
>
{versions[0].text}
{currentVersion.text}
</Button>
<Menu
id="mui-version-menu"
Expand Down Expand Up @@ -452,7 +454,28 @@ export default function AppNavDrawer(props) {
metadata="MUI X"
versionSelector={renderVersionSelector([
// DATA_GRID_VERSION is set from the X repo
{ text: `v${process.env.DATA_GRID_VERSION}`, current: true },
{
text: 'v6-alpha',
...(process.env.DATA_GRID_VERSION.startsWith('6')
? {
text: `v${process.env.DATA_GRID_VERSION}`,
current: true,
}
: {
href: `https://next.mui.com${languagePrefix}/components/data-grid/`,
}),
},
{
text: 'v5',
...(process.env.DATA_GRID_VERSION.startsWith('5')
? {
text: `v${process.env.DATA_GRID_VERSION}`,
current: true,
}
: {
href: `https://mui.com${languagePrefix}/components/data-grid/`,
}),
},
{ text: 'v4', href: `https://v4.mui.com${languagePrefix}/components/data-grid/` },
])}
/>
Expand All @@ -464,7 +487,28 @@ export default function AppNavDrawer(props) {
metadata="MUI X"
versionSelector={renderVersionSelector([
// DATE_PICKERS_VERSION is set from the X repo
{ text: `v${process.env.DATE_PICKERS_VERSION}`, current: true },
{
...(process.env.DATE_PICKERS_VERSION.startsWith('6')
? {
text: `v${process.env.DATE_PICKERS_VERSION}`,
current: true,
}
: {
text: `v6-alpha`,
href: `https://next.mui.com${languagePrefix}/components/data-grid/`,
}),
},
{
...(process.env.DATE_PICKERS_VERSION.startsWith('5')
? {
text: `v${process.env.DATE_PICKERS_VERSION}`,
current: true,
}
: {
text: `v5`,
href: `https://mui.com${languagePrefix}/components/data-grid/`,
}),
},
])}
/>
)}
Expand Down

0 comments on commit 55d2254

Please sign in to comment.