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] Move the demo higher in the API TOC #35202

Merged
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
16 changes: 12 additions & 4 deletions docs/src/modules/components/ApiPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ ClassesTable.propTypes = {

function getTranslatedHeader(t, header) {
const translations = {
demos: t('api-docs.demos'),
import: t('api-docs.import'),
'component-name': t('api-docs.componentName'),
props: t('api-docs.props'),
inheritance: t('api-docs.inheritance'),
demos: t('api-docs.demos'),
css: 'CSS',
};

Expand Down Expand Up @@ -253,12 +253,12 @@ function ApiDocs(props) {
}

const toc = [
createTocEntry('demos'),
createTocEntry('import'),
...componentDescriptionToc,
componentStyles.name && createTocEntry('component-name'),
createTocEntry('props'),
componentStyles.classes.length > 0 && createTocEntry('css'),
createTocEntry('demos'),
].filter(Boolean);

// The `ref` is forwarded to the root element.
Expand Down Expand Up @@ -298,6 +298,16 @@ function ApiDocs(props) {
<Typography variant="h5" component="p" className="description" gutterBottom>
{description}
</Typography>
<Heading hash="demos" />
<div className="MuiCallout-root MuiCallout-info">
<p
dangerouslySetInnerHTML={{
__html:
'For examples and details on the usage of this React component, visit the component demo pages:',
}}
/>
<span dangerouslySetInnerHTML={{ __html: demos }} />
</div>
<Heading hash="import" />
<HighlightedCode
code={`
Expand Down Expand Up @@ -376,8 +386,6 @@ import { ${componentName} } from '${source}';`}
/>
</React.Fragment>
) : null}
<Heading hash="demos" />
<span dangerouslySetInnerHTML={{ __html: demos }} />
</MarkdownElement>
<svg style={{ display: 'none' }} xmlns="http://www.w3.org/2000/svg">
<symbol id="anchor-link-icon" viewBox="0 0 16 16">
Expand Down
2 changes: 1 addition & 1 deletion docs/translations/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"nativeElement": "native",
"overrideStyles": "You can override the style of the component using one of these customization options:\n",
"overrideStylesStyledComponent": "<ul>\n<li>With a <a href=\"/material-ui/guides/interoperability/#global-css\">global class name</a>.</li>\n<li>With a rule name as part of the component's <a href=\"/material-ui/customization/theme-components/#global-style-overrides\"><code>styleOverrides</code> property</a> in a custom theme.</li>\n</ul>",
"pageDescription": "API documentation for the React {{name}} component. Learn about the available props and the CSS API.",
"pageDescription": "API reference docs for the React {{name}} component. Learn about the props, CSS, and other APIs of this exported module.",
"props": "Props",
"refNotHeld": "The component cannot hold a ref.",
"refRootElement": "The <code>ref</code> is forwarded to the root element.",
Expand Down