Skip to content

Commit

Permalink
[website] Split Toolpad documentation (#41316)
Browse files Browse the repository at this point in the history
  • Loading branch information
bharatkashyap committed Mar 15, 2024
1 parent 2e7bb84 commit ba9baae
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/src/components/header/HeaderNavBar.tsx
Expand Up @@ -302,7 +302,7 @@ export default function HeaderNavBar() {
id={PRODUCT_IDS[4]}
href={ROUTES.productToolpad}
icon={<IconImage name="product-toolpad" />}
name="MUI Toolpad"
name="Toolpad"
chip={<Chip label="Beta" size="small" color="primary" variant="outlined" />}
description="Low-code admin builder."
/>
Expand Down
8 changes: 4 additions & 4 deletions docs/src/components/header/HeaderNavDropdown.tsx
Expand Up @@ -76,7 +76,7 @@ const PRODUCTS = [
href: ROUTES.productDesignKits,
},
{
name: 'MUI Toolpad',
name: 'Toolpad',
description: 'Low-code admin builder.',
href: ROUTES.productToolpad,
chip: 'Beta',
Expand Down Expand Up @@ -110,9 +110,9 @@ const DOCS = [
href: ROUTES.xIntro,
},
{
name: 'MUI Toolpad',
description: 'Low-code admin builder.',
href: ROUTES.toolpadDocs,
name: 'Toolpad',
description: 'Low-code admin builder',
href: ROUTES.toolpadStudioDocs,
chip: 'Beta',
},
];
Expand Down
2 changes: 1 addition & 1 deletion docs/src/layouts/AppFooter.tsx
Expand Up @@ -83,7 +83,7 @@ export default function AppFooter(props: AppFooterProps) {
MUI X
</Link>
<Link prefetch={false} href={ROUTES.productToolpad}>
MUI Toolpad
Toolpad
</Link>
<Link prefetch={false} href={ROUTES.productTemplates}>
Templates
Expand Down
2 changes: 2 additions & 0 deletions docs/src/modules/components/AppSearch.js
Expand Up @@ -273,6 +273,8 @@ const productNameProductId = {
x: 'MUI X',
system: 'MUI System',
toolpad: 'Toolpad',
'toolpad-studio': 'Toolpad Studio',
'toolpad-core': 'Toolpad Core',
};

export function convertProductIdToName(productInfo) {
Expand Down
4 changes: 2 additions & 2 deletions docs/src/modules/components/MuiProductSelector.tsx
Expand Up @@ -186,7 +186,7 @@ export default function MuiProductSelector() {
</Box>
<li role="none">
<Link
href={ROUTES.toolpadDocs}
href={ROUTES.toolpadStudioDocs}
sx={(theme) => ({
p: 2,
pr: 3,
Expand All @@ -204,7 +204,7 @@ export default function MuiProductSelector() {
<ProductSubMenu
role="menuitem"
icon={<IconImage name="product-toolpad" />}
name="MUI Toolpad"
name="Toolpad"
description="Low-code admin builder."
chip={<Chip size="small" label="Beta" color="primary" variant="outlined" />}
/>
Expand Down
15 changes: 11 additions & 4 deletions docs/src/modules/utils/getProductInfoFromUrl.test.js
Expand Up @@ -90,10 +90,17 @@ describe('getProductInfoFromUrl', () => {
});
});

it('should handle MUI Toolpad', () => {
expect(getProductInfoFromUrl('/toolpad/getting-started/first-app/')).to.deep.equal({
productCategoryId: 'null',
productId: 'toolpad',
it('should handle Toolpad Core', () => {
expect(getProductInfoFromUrl('/toolpad/getting-started/')).to.deep.equal({
productCategoryId: 'toolpad',
productId: 'toolpad-core',
});
});

it('should handle Toolpad Studio', () => {
expect(getProductInfoFromUrl('/toolpad/studio/getting-started/first-app/')).to.deep.equal({
productCategoryId: 'toolpad',
productId: 'toolpad-studio',
});
});
});
12 changes: 11 additions & 1 deletion docs/src/modules/utils/getProductInfoFromUrl.ts
Expand Up @@ -51,7 +51,17 @@ export default function getProductInfoFromUrl(asPath: string): MuiProductInfo {
}
}

if (firstFolder === 'toolpad' || firstFolder === 'docs') {
if (firstFolder === 'toolpad') {
productCategoryId = 'toolpad';
const secondFolder = asPathWithoutLang.replace(/^\/+[^/]+\/([^/]+)\/.*/, '$1');
if (secondFolder === 'studio') {
productId = 'toolpad-studio';
} else {
productId = 'toolpad-core';
}
}

if (firstFolder === 'docs') {
productId = firstFolder;
}

Expand Down
1 change: 1 addition & 0 deletions docs/src/route.ts
Expand Up @@ -50,6 +50,7 @@ const ROUTES = {
treeViewOverview: '/x/react-tree-view/',
// Toolpad pages
toolpadDocs: '/toolpad/getting-started/',
toolpadStudioDocs: '/toolpad/studio/getting-started',
// External pages
rssFeed: '/feed/blog/rss.xml',
handbook: 'https://mui-org.notion.site/Handbook-f086d47e10794d5e839aef9dc67f324b',
Expand Down
2 changes: 1 addition & 1 deletion docs/writing-rules/BrandName.yml
Expand Up @@ -15,7 +15,7 @@ swap:
MUI System: MUI System
MUI Store: MUI Store
MUI Core: MUI Core
MUI Toolpad: MUI Toolpad
Toolpad: Toolpad
MUI Connect: MUI Connect
Stack Overflow: Stack Overflow
Pigment CSS: Pigment CSS
Expand Down

0 comments on commit ba9baae

Please sign in to comment.