Skip to content

Commit

Permalink
[docs] Fix API page ad space regression
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Nov 30, 2022
1 parent 14a8db7 commit 5b77c9c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
22 changes: 14 additions & 8 deletions docs/src/modules/components/ApiPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { useTranslate, useUserLanguage } from 'docs/src/modules/utils/i18n';
import HighlightedCode from 'docs/src/modules/components/HighlightedCode';
import MarkdownElement from 'docs/src/modules/components/MarkdownElement';
import AppLayoutDocs from 'docs/src/modules/components/AppLayoutDocs';
import Ad from 'docs/src/modules/components/Ad';

const Asterisk = styled('abbr')(({ theme }) => ({ color: theme.palette.error.main }));

Expand Down Expand Up @@ -212,8 +213,8 @@ Heading.propTypes = {
level: PropTypes.string,
};

function ApiDocs(props) {
const { descriptions, pageContent } = props;
export default function ApiPage(props) {
const { descriptions, disableAd = false, pageContent } = props;
const t = useTranslate();
const userLanguage = useUserLanguage();

Expand Down Expand Up @@ -310,16 +311,22 @@ function ApiDocs(props) {
return (
<AppLayoutDocs
description={description}
disableAd={false}
disableAd={disableAd}
disableToc={false}
location={apiSourceLocation}
title={`${componentName} API`}
toc={toc}
>
<MarkdownElement>
<h1>{componentName} API</h1>
<Typography variant="h5" component="p" className="description" gutterBottom>
<Typography
variant="h5"
component="p"
className={`description${disableAd ? '' : ' ad'}`}
gutterBottom
>
{description}
{disableAd ? null : <Ad />}
</Typography>
<Heading hash="import" />
<HighlightedCode code={imports.join(`\n// ${t('or')}\n`)} language="jsx" />
Expand Down Expand Up @@ -411,13 +418,12 @@ function ApiDocs(props) {
);
}

ApiDocs.propTypes = {
ApiPage.propTypes = {
descriptions: PropTypes.object.isRequired,
disableAd: PropTypes.bool,
pageContent: PropTypes.object.isRequired,
};

if (process.env.NODE_ENV !== 'production') {
ApiDocs.propTypes = exactProp(ApiDocs.propTypes);
ApiPage.propTypes = exactProp(ApiPage.propTypes);
}

export default ApiDocs;
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2479,8 +2479,8 @@
react-transition-group "^4.4.5"

"@mui/monorepo@https://github.com/mui/material-ui.git#master":
version "5.10.14"
resolved "https://github.com/mui/material-ui.git#1b86330da8fff81ce5c28b0c5da0cebeb2be6932"
version "5.10.16"
resolved "https://github.com/mui/material-ui.git#b8e30a4b7c668ede64d5f1f76c00401590c977c1"

"@mui/private-theming@^5.10.14":
version "5.10.14"
Expand Down

0 comments on commit 5b77c9c

Please sign in to comment.