Skip to content

Commit

Permalink
[docs] Option to disable ads (#22574)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Sep 13, 2020
1 parent ea271fc commit 4f502ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
9 changes: 4 additions & 5 deletions docs/src/modules/components/Demo.js
Expand Up @@ -700,8 +700,8 @@ const useStyles = makeStyles(
{ name: 'Demo' },
);

function Demo(props) {
const { demo, demoOptions, githubLocation } = props;
export default function Demo(props) {
const { demo, demoOptions, disableAd, githubLocation } = props;
const classes = useStyles();
const t = useSelector((state) => state.options.t);
const codeVariant = useSelector((state) => state.options.codeVariant);
Expand Down Expand Up @@ -821,15 +821,14 @@ function Demo(props) {
/>
</div>
</Collapse>
{showAd ? <AdCarbonInline /> : null}
{showAd && !disableAd && !demoOptions.disableAd ? <AdCarbonInline /> : null}
</div>
);
}

Demo.propTypes = {
demo: PropTypes.object.isRequired,
demoOptions: PropTypes.object.isRequired,
disableAd: PropTypes.bool.isRequired,
githubLocation: PropTypes.string.isRequired,
};

export default Demo;
1 change: 1 addition & 0 deletions docs/src/modules/components/MarkdownDocs.js
Expand Up @@ -178,6 +178,7 @@ function MarkdownDocs(props) {
rawTS: demo.rawTS,
tsx: demo.moduleTS ? requireDemo(demo.moduleTS).default : null,
}}
disableAd={disableAd}
demoOptions={renderedMarkdownOrDemo}
githubLocation={`${SOURCE_CODE_ROOT_URL}/docs/src/${name}`}
/>
Expand Down

0 comments on commit 4f502ce

Please sign in to comment.