Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs-infra] Remove randomized API page layout #11876

Merged
merged 14 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion docs/pages/x/api/data-grid/data-grid-premium.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import * as React from 'react';
import ApiPage from 'docs/src/modules/components/ApiPage';
import mapApiPageTranslations from 'docs/src/modules/utils/mapApiPageTranslations';
import { dataGridLayoutKeys } from 'docsx/src/modules/utils/layoutStorageKey';
import jsonPageContent from './data-grid-premium.json';

export default function Page(props) {
const { descriptions, pageContent } = props;
return <ApiPage descriptions={descriptions} pageContent={pageContent} />;
return (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These pages are now generated by ComponentApiBuilder 🙃

<ApiPage
defaultLayout="expanded"
layoutStorageKey={dataGridLayoutKeys}
descriptions={descriptions}
pageContent={pageContent}
/>
);
}

Page.getInitialProps = () => {
Expand Down
10 changes: 9 additions & 1 deletion docs/pages/x/api/data-grid/data-grid-pro.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import * as React from 'react';
import ApiPage from 'docs/src/modules/components/ApiPage';
import mapApiPageTranslations from 'docs/src/modules/utils/mapApiPageTranslations';
import { dataGridLayoutKeys } from 'docsx/src/modules/utils/layoutStorageKey';
import jsonPageContent from './data-grid-pro.json';

export default function Page(props) {
const { descriptions, pageContent } = props;
return <ApiPage descriptions={descriptions} pageContent={pageContent} />;
return (
<ApiPage
defaultLayout="expanded"
layoutStorageKey={dataGridLayoutKeys}
descriptions={descriptions}
pageContent={pageContent}
/>
);
}

Page.getInitialProps = () => {
Expand Down
10 changes: 9 additions & 1 deletion docs/pages/x/api/data-grid/data-grid.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import * as React from 'react';
import ApiPage from 'docs/src/modules/components/ApiPage';
import mapApiPageTranslations from 'docs/src/modules/utils/mapApiPageTranslations';
import { dataGridLayoutKeys } from 'docsx/src/modules/utils/layoutStorageKey';
import jsonPageContent from './data-grid.json';

export default function Page(props) {
const { descriptions, pageContent } = props;
return <ApiPage descriptions={descriptions} pageContent={pageContent} />;
return (
<ApiPage
defaultLayout="expanded"
layoutStorageKey={dataGridLayoutKeys}
descriptions={descriptions}
pageContent={pageContent}
/>
);
}

Page.getInitialProps = () => {
Expand Down
10 changes: 9 additions & 1 deletion docs/pages/x/api/data-grid/grid-filter-form.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import * as React from 'react';
import ApiPage from 'docs/src/modules/components/ApiPage';
import mapApiPageTranslations from 'docs/src/modules/utils/mapApiPageTranslations';
import { dataGridLayoutKeys } from 'docsx/src/modules/utils/layoutStorageKey';
import jsonPageContent from './grid-filter-form.json';

export default function Page(props) {
const { descriptions, pageContent } = props;
return <ApiPage descriptions={descriptions} pageContent={pageContent} />;
return (
<ApiPage
defaultLayout="expanded"
layoutStorageKey={dataGridLayoutKeys}
descriptions={descriptions}
pageContent={pageContent}
/>
);
}

Page.getInitialProps = () => {
Expand Down
10 changes: 9 additions & 1 deletion docs/pages/x/api/data-grid/grid-filter-panel.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import * as React from 'react';
import ApiPage from 'docs/src/modules/components/ApiPage';
import mapApiPageTranslations from 'docs/src/modules/utils/mapApiPageTranslations';
import { dataGridLayoutKeys } from 'docsx/src/modules/utils/layoutStorageKey';
import jsonPageContent from './grid-filter-panel.json';

export default function Page(props) {
const { descriptions, pageContent } = props;
return <ApiPage descriptions={descriptions} pageContent={pageContent} />;
return (
<ApiPage
defaultLayout="expanded"
layoutStorageKey={dataGridLayoutKeys}
descriptions={descriptions}
pageContent={pageContent}
/>
);
}

Page.getInitialProps = () => {
Expand Down
10 changes: 9 additions & 1 deletion docs/pages/x/api/data-grid/grid-toolbar-quick-filter.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import * as React from 'react';
import ApiPage from 'docs/src/modules/components/ApiPage';
import mapApiPageTranslations from 'docs/src/modules/utils/mapApiPageTranslations';
import { dataGridLayoutKeys } from 'docsx/src/modules/utils/layoutStorageKey';
import jsonPageContent from './grid-toolbar-quick-filter.json';

export default function Page(props) {
const { descriptions, pageContent } = props;
return <ApiPage descriptions={descriptions} pageContent={pageContent} />;
return (
<ApiPage
defaultLayout="expanded"
layoutStorageKey={dataGridLayoutKeys}
descriptions={descriptions}
pageContent={pageContent}
/>
);
}

Page.getInitialProps = () => {
Expand Down
5 changes: 5 additions & 0 deletions docs/src/modules/utils/layoutStorageKey.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const dataGridLayoutKeys = {
slots: 'dataGrid_apiPage_slots',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note: I just realized that the slots section is missing the v7 data grid docs:

v6: https://mui.com/x/api/data-grid/data-grid/#slots
v7: https://next.mui.com/x/api/data-grid/data-grid/#slots

Any ideas on how to bring it back? 😅

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the slots are generated by detecting interfaces named [componentName]Slots.

You can override this behavior with slotInterfaceName

Here is the uscase for date pickers:
https://github.com/mui/mui-x/blob/master/scripts/buildApiDocs/pickersSettings/getComponentInfo.ts/#L26-L28

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the fix

props: 'dataGrid_apiPage_props',
classes: 'dataGrid_apiPage_classes',
} as const;
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1891,8 +1891,8 @@
react-transition-group "^4.4.5"

"@mui/monorepo@https://github.com/mui/material-ui.git#master":
version "5.15.9"
resolved "https://github.com/mui/material-ui.git#97bd4c7ccc25a106a53be29d4267e317b782cb2e"
version "5.15.10"
resolved "https://github.com/mui/material-ui.git#c5b4ebac51979272121a3b4369e43cf41509dad8"
dependencies:
"@googleapis/sheets" "^5.0.5"
"@slack/bolt" "^3.17.1"
Expand Down
Loading