Skip to content

Commit

Permalink
[core] Replace getInitialProps with getStaticProps (mui#33684)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnajdova authored and Daniel Rabe committed Nov 29, 2022
1 parent 1ba2425 commit 7b5e0e9
Show file tree
Hide file tree
Showing 168 changed files with 1,003 additions and 669 deletions.
10 changes: 6 additions & 4 deletions docs/pages/base/api/badge-unstyled.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function Page(props) {
return <ApiPage descriptions={descriptions} pageContent={pageContent} />;
}

Page.getInitialProps = () => {
export function getStaticProps() {
const req = require.context(
'docs/translations/api-docs/badge-unstyled',
false,
Expand All @@ -17,7 +17,9 @@ Page.getInitialProps = () => {
const descriptions = mapApiPageTranslations(req);

return {
descriptions,
pageContent: jsonPageContent,
props: {
descriptions,
pageContent: jsonPageContent,
},
};
};
}
10 changes: 6 additions & 4 deletions docs/pages/base/api/button-unstyled.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function Page(props) {
return <ApiPage descriptions={descriptions} pageContent={pageContent} />;
}

Page.getInitialProps = () => {
export function getStaticProps() {
const req = require.context(
'docs/translations/api-docs/button-unstyled',
false,
Expand All @@ -17,7 +17,9 @@ Page.getInitialProps = () => {
const descriptions = mapApiPageTranslations(req);

return {
descriptions,
pageContent: jsonPageContent,
props: {
descriptions,
pageContent: jsonPageContent,
},
};
};
}
10 changes: 6 additions & 4 deletions docs/pages/base/api/click-away-listener.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function Page(props) {
return <ApiPage descriptions={descriptions} pageContent={pageContent} />;
}

Page.getInitialProps = () => {
export function getStaticProps() {
const req = require.context(
'docs/translations/api-docs/click-away-listener',
false,
Expand All @@ -17,7 +17,9 @@ Page.getInitialProps = () => {
const descriptions = mapApiPageTranslations(req);

return {
descriptions,
pageContent: jsonPageContent,
props: {
descriptions,
pageContent: jsonPageContent,
},
};
};
}
10 changes: 6 additions & 4 deletions docs/pages/base/api/form-control-unstyled.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function Page(props) {
return <ApiPage descriptions={descriptions} pageContent={pageContent} />;
}

Page.getInitialProps = () => {
export function getStaticProps() {
const req = require.context(
'docs/translations/api-docs/form-control-unstyled',
false,
Expand All @@ -17,7 +17,9 @@ Page.getInitialProps = () => {
const descriptions = mapApiPageTranslations(req);

return {
descriptions,
pageContent: jsonPageContent,
props: {
descriptions,
pageContent: jsonPageContent,
},
};
};
}
10 changes: 6 additions & 4 deletions docs/pages/base/api/input-unstyled.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function Page(props) {
return <ApiPage descriptions={descriptions} pageContent={pageContent} />;
}

Page.getInitialProps = () => {
export function getStaticProps() {
const req = require.context(
'docs/translations/api-docs/input-unstyled',
false,
Expand All @@ -17,7 +17,9 @@ Page.getInitialProps = () => {
const descriptions = mapApiPageTranslations(req);

return {
descriptions,
pageContent: jsonPageContent,
props: {
descriptions,
pageContent: jsonPageContent,
},
};
};
}
10 changes: 6 additions & 4 deletions docs/pages/base/api/menu-item-unstyled.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function Page(props) {
return <ApiPage descriptions={descriptions} pageContent={pageContent} />;
}

Page.getInitialProps = () => {
export function getStaticProps() {
const req = require.context(
'docs/translations/api-docs/menu-item-unstyled',
false,
Expand All @@ -17,7 +17,9 @@ Page.getInitialProps = () => {
const descriptions = mapApiPageTranslations(req);

return {
descriptions,
pageContent: jsonPageContent,
props: {
descriptions,
pageContent: jsonPageContent,
},
};
};
}
10 changes: 6 additions & 4 deletions docs/pages/base/api/menu-unstyled.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function Page(props) {
return <ApiPage descriptions={descriptions} pageContent={pageContent} />;
}

Page.getInitialProps = () => {
export function getStaticProps() {
const req = require.context(
'docs/translations/api-docs/menu-unstyled',
false,
Expand All @@ -17,7 +17,9 @@ Page.getInitialProps = () => {
const descriptions = mapApiPageTranslations(req);

return {
descriptions,
pageContent: jsonPageContent,
props: {
descriptions,
pageContent: jsonPageContent,
},
};
};
}
10 changes: 6 additions & 4 deletions docs/pages/base/api/modal-unstyled.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function Page(props) {
return <ApiPage descriptions={descriptions} pageContent={pageContent} />;
}

Page.getInitialProps = () => {
export function getStaticProps() {
const req = require.context(
'docs/translations/api-docs/modal-unstyled',
false,
Expand All @@ -17,7 +17,9 @@ Page.getInitialProps = () => {
const descriptions = mapApiPageTranslations(req);

return {
descriptions,
pageContent: jsonPageContent,
props: {
descriptions,
pageContent: jsonPageContent,
},
};
};
}
10 changes: 6 additions & 4 deletions docs/pages/base/api/multi-select-unstyled.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function Page(props) {
return <ApiPage descriptions={descriptions} pageContent={pageContent} />;
}

Page.getInitialProps = () => {
export function getStaticProps() {
const req = require.context(
'docs/translations/api-docs/multi-select-unstyled',
false,
Expand All @@ -17,7 +17,9 @@ Page.getInitialProps = () => {
const descriptions = mapApiPageTranslations(req);

return {
descriptions,
pageContent: jsonPageContent,
props: {
descriptions,
pageContent: jsonPageContent,
},
};
};
}
10 changes: 6 additions & 4 deletions docs/pages/base/api/no-ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ export default function Page(props) {
return <ApiPage descriptions={descriptions} pageContent={pageContent} />;
}

Page.getInitialProps = () => {
export function getStaticProps() {
const req = require.context('docs/translations/api-docs/no-ssr', false, /no-ssr.*.json$/);
const descriptions = mapApiPageTranslations(req);

return {
descriptions,
pageContent: jsonPageContent,
props: {
descriptions,
pageContent: jsonPageContent,
},
};
};
}
10 changes: 6 additions & 4 deletions docs/pages/base/api/option-group-unstyled.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function Page(props) {
return <ApiPage descriptions={descriptions} pageContent={pageContent} />;
}

Page.getInitialProps = () => {
export function getStaticProps() {
const req = require.context(
'docs/translations/api-docs/option-group-unstyled',
false,
Expand All @@ -17,7 +17,9 @@ Page.getInitialProps = () => {
const descriptions = mapApiPageTranslations(req);

return {
descriptions,
pageContent: jsonPageContent,
props: {
descriptions,
pageContent: jsonPageContent,
},
};
};
}
10 changes: 6 additions & 4 deletions docs/pages/base/api/option-unstyled.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function Page(props) {
return <ApiPage descriptions={descriptions} pageContent={pageContent} />;
}

Page.getInitialProps = () => {
export function getStaticProps() {
const req = require.context(
'docs/translations/api-docs/option-unstyled',
false,
Expand All @@ -17,7 +17,9 @@ Page.getInitialProps = () => {
const descriptions = mapApiPageTranslations(req);

return {
descriptions,
pageContent: jsonPageContent,
props: {
descriptions,
pageContent: jsonPageContent,
},
};
};
}
10 changes: 6 additions & 4 deletions docs/pages/base/api/popper-unstyled.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function Page(props) {
return <ApiPage descriptions={descriptions} pageContent={pageContent} />;
}

Page.getInitialProps = () => {
export function getStaticProps() {
const req = require.context(
'docs/translations/api-docs/popper-unstyled',
false,
Expand All @@ -17,7 +17,9 @@ Page.getInitialProps = () => {
const descriptions = mapApiPageTranslations(req);

return {
descriptions,
pageContent: jsonPageContent,
props: {
descriptions,
pageContent: jsonPageContent,
},
};
};
}
10 changes: 6 additions & 4 deletions docs/pages/base/api/portal.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ export default function Page(props) {
return <ApiPage descriptions={descriptions} pageContent={pageContent} />;
}

Page.getInitialProps = () => {
export function getStaticProps() {
const req = require.context('docs/translations/api-docs/portal', false, /portal.*.json$/);
const descriptions = mapApiPageTranslations(req);

return {
descriptions,
pageContent: jsonPageContent,
props: {
descriptions,
pageContent: jsonPageContent,
},
};
};
}
10 changes: 6 additions & 4 deletions docs/pages/base/api/select-unstyled.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function Page(props) {
return <ApiPage descriptions={descriptions} pageContent={pageContent} />;
}

Page.getInitialProps = () => {
export function getStaticProps() {
const req = require.context(
'docs/translations/api-docs/select-unstyled',
false,
Expand All @@ -17,7 +17,9 @@ Page.getInitialProps = () => {
const descriptions = mapApiPageTranslations(req);

return {
descriptions,
pageContent: jsonPageContent,
props: {
descriptions,
pageContent: jsonPageContent,
},
};
};
}
10 changes: 6 additions & 4 deletions docs/pages/base/api/slider-unstyled.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function Page(props) {
return <ApiPage descriptions={descriptions} pageContent={pageContent} />;
}

Page.getInitialProps = () => {
export function getStaticProps() {
const req = require.context(
'docs/translations/api-docs/slider-unstyled',
false,
Expand All @@ -17,7 +17,9 @@ Page.getInitialProps = () => {
const descriptions = mapApiPageTranslations(req);

return {
descriptions,
pageContent: jsonPageContent,
props: {
descriptions,
pageContent: jsonPageContent,
},
};
};
}
10 changes: 6 additions & 4 deletions docs/pages/base/api/switch-unstyled.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function Page(props) {
return <ApiPage descriptions={descriptions} pageContent={pageContent} />;
}

Page.getInitialProps = () => {
export function getStaticProps() {
const req = require.context(
'docs/translations/api-docs/switch-unstyled',
false,
Expand All @@ -17,7 +17,9 @@ Page.getInitialProps = () => {
const descriptions = mapApiPageTranslations(req);

return {
descriptions,
pageContent: jsonPageContent,
props: {
descriptions,
pageContent: jsonPageContent,
},
};
};
}
10 changes: 6 additions & 4 deletions docs/pages/base/api/tab-panel-unstyled.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function Page(props) {
return <ApiPage descriptions={descriptions} pageContent={pageContent} />;
}

Page.getInitialProps = () => {
export function getStaticProps() {
const req = require.context(
'docs/translations/api-docs/tab-panel-unstyled',
false,
Expand All @@ -17,7 +17,9 @@ Page.getInitialProps = () => {
const descriptions = mapApiPageTranslations(req);

return {
descriptions,
pageContent: jsonPageContent,
props: {
descriptions,
pageContent: jsonPageContent,
},
};
};
}
Loading

0 comments on commit 7b5e0e9

Please sign in to comment.