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] Fix API page ad space regression #7051

Merged
merged 1 commit into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
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