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] API pages i18n #23214

Merged
merged 58 commits into from
Nov 16, 2020
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
5c70d52
[docs] API pages I18n
mbrookes Oct 12, 2020
5df6ce0
Fixes
mbrookes Oct 23, 2020
ac9aba5
rename generateMarkdown
mbrookes Oct 23, 2020
8ee43ac
advanced prop descriptions
mbrookes Oct 23, 2020
dcb7a72
prop-type folding
mbrookes Oct 23, 2020
2843488
twiddling
mbrookes Oct 23, 2020
549add9
Add component description
mbrookes Oct 23, 2020
5d144db
zh component API
mbrookes Oct 24, 2020
a086487
combine classDescription & classCondition files
mbrookes Oct 25, 2020
ea860a9
remove duplication from component class definition
mbrookes Oct 25, 2020
c12abb7
dedupe names
mbrookes Oct 25, 2020
2257dd4
smaller default
mbrookes Oct 25, 2020
a513adf
refactor type description
mbrookes Oct 25, 2020
7cc13c8
all bool defaults are false
mbrookes Oct 25, 2020
865aa87
no false required
mbrookes Oct 25, 2020
988c3b9
Optimize globalClasses
mbrookes Oct 25, 2020
9fa1f56
prettier
mbrookes Oct 25, 2020
597b095
refactor
mbrookes Oct 25, 2020
d193294
Include non-false bool prop defaults
mbrookes Oct 26, 2020
af067f1
Only update Accordion for ease of review
mbrookes Oct 26, 2020
0910a7d
Merge branch 'next' into docs-api-i18n
mbrookes Oct 26, 2020
c78c9fe
revert markdowndocs split
mbrookes Oct 27, 2020
8c3e73e
Tidy up ApiDocs component
mbrookes Oct 27, 2020
de82ef0
More cleanup
mbrookes Oct 27, 2020
74835d0
No markdown headings
mbrookes Oct 28, 2020
db2f813
Convert markdown to HTML at source
mbrookes Oct 28, 2020
4c41fc0
Parse markdown at build
mbrookes Oct 28, 2020
cb63792
Merge branch 'next' into docs-api-i18n
mbrookes Oct 28, 2020
8579446
Update with new useTranslate hook
mbrookes Oct 28, 2020
1f4687a
Use inline markdown
mbrookes Oct 29, 2020
f664b32
Merge branch 'next' into docs-api-i18n
mbrookes Oct 30, 2020
be8007e
Merge branch 'next' into docs-api-i18n
mbrookes Oct 31, 2020
29ff721
Update docs/pages/api-docs/<component>.js output
mbrookes Oct 31, 2020
c505ebb
Use getInitialProps for now
mbrookes Nov 11, 2020
af8aa31
Merge branch 'next' into docs-api-i18n
mbrookes Nov 11, 2020
856fcb0
disable translations
mbrookes Nov 11, 2020
feda7e9
Fix spreadHint link
mbrookes Nov 11, 2020
dc4b187
yarn prettier
oliviertassinari Nov 14, 2020
f568942
Apply suggestion from code review
mbrookes Nov 14, 2020
e6be51d
Extract TopLayout for MarkdownDocs to separate component
mbrookes Nov 14, 2020
56b254d
Use TopLayout for ApiDocs
mbrookes Nov 14, 2020
18589e9
prefix API specific translation keys with api
mbrookes Nov 15, 2020
86cfb46
Fix conditions (used to treat this as markdown)
mbrookes Nov 15, 2020
fb68362
remove CSS from l10n
mbrookes Nov 15, 2020
9dbdc35
fix some errors
oliviertassinari Nov 15, 2020
5573b4f
fix more errors
oliviertassinari Nov 15, 2020
3bb7e5d
fix display of ad
oliviertassinari Nov 15, 2020
a9016bc
fix prettier
oliviertassinari Nov 15, 2020
d40375a
better <code> replacement
mbrookes Nov 15, 2020
a9fc891
lint
mbrookes Nov 15, 2020
5c1ad30
Apply to all pages
mbrookes Nov 15, 2020
ede966c
Merge branch 'next' into docs-api-i18n
mbrookes Nov 15, 2020
5f557fc
Fix CSS heading
mbrookes Nov 16, 2020
ee629d5
[docs] Fix proptypes warnings
oliviertassinari Nov 16, 2020
b9c5999
Merge branch 'next' into foo
oliviertassinari Nov 16, 2020
05e85c4
make it possible to run static analysis on the codebase
oliviertassinari Nov 16, 2020
08f7702
add missing "CSS" header in the toc
oliviertassinari Nov 16, 2020
3f6f086
Matt's review
oliviertassinari Nov 16, 2020
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
32 changes: 22 additions & 10 deletions docs/pages/api-docs/accordion.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
import React from 'react';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import { prepareMarkdown } from 'docs/src/modules/utils/parseMarkdown';
import ApiDocs from 'docs/src/modules/components/ApiDocs';
import mapApiTranslations, { parsePropsMarkdown } from 'docs/src/modules/utils/mapApiTranslations';
import jsonPageContent from './accordion.json';

const pageFilename = 'api/accordion';
const requireRaw = require.context('!raw-loader!./', false, /\/accordion\.md$/);

export default function Page({ docs }) {
return <MarkdownDocs docs={docs} />;
export default function Page({ pageContent }) {
return <ApiDocs pageContent={pageContent} />;
mbrookes marked this conversation as resolved.
Show resolved Hide resolved
oliviertassinari marked this conversation as resolved.
Show resolved Hide resolved
}

Page.getInitialProps = () => {
const { demos, docs } = prepareMarkdown({ pageFilename, requireRaw });
return { demos, docs };
Page.getInitialProps = async (ctx) => {
const req1 = require.context('docs/translations', false, /component-descriptions.*.json$/);
const req2 = require.context('docs/translations', false, /prop-descriptions.*.json$/);
const req3 = require.context('docs/translations', false, /class-descriptions.*.json$/);

const componentDescription = mapApiTranslations(req1, 'Accordion');
const propDescriptions = parsePropsMarkdown(mapApiTranslations(req2, 'Accordion'));
const classDescriptions = mapApiTranslations(req3, 'Accordion');

const pageContent = {
...jsonPageContent,
componentDescription,
propDescriptions,
classDescriptions,
};

return { pageContent };
};
25 changes: 25 additions & 0 deletions docs/pages/api-docs/accordion.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"props": {
"children": { "type": { "name": "custom", "description": "node" } },
"classes": { "type": { "name": "object" } },
"className": { "type": { "name": "string" }, "required": false, "description": "@ignore" },
"defaultExpanded": { "type": { "name": "bool" } },
"disabled": { "type": { "name": "bool" } },
"expanded": { "type": { "name": "bool" } },
"onChange": { "type": { "name": "func" } },
"square": { "type": { "name": "bool" } },
"TransitionComponent": { "type": { "name": "elementType" }, "default": "Collapse" },
"TransitionProps": { "type": { "name": "object" } }
},
"name": "Accordion",
"styles": {
"classes": ["root", "rounded", "expanded", "disabled", "region"],
"globalClasses": { "expanded": "Mui-expanded", "disabled": "Mui-disabled" }
},
"spread": true,
"forwardsRefTo": "HTMLDivElement",
"filename": "/packages/material-ui/src/Accordion/Accordion.js",
"inheritance": { "component": "Paper", "pathname": "/api/paper/" },
"demos": "<ul><li><a href=\"/components/accordion/\">Accordion</a></li></ul>",
"styledComponent": false
}
71 changes: 0 additions & 71 deletions docs/pages/api-docs/accordion.md

This file was deleted.

Loading