Skip to content

Commit

Permalink
[Pickers] Enable YearPicker documentation (#24830)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari authored Feb 8, 2021
1 parent 09698dc commit 3cd6f30
Show file tree
Hide file tree
Showing 12 changed files with 109 additions and 3 deletions.
23 changes: 23 additions & 0 deletions docs/pages/api-docs/year-picker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import * as React from 'react';
import ApiPage from 'docs/src/modules/components/ApiPage';
import mapApiPageTranslations from 'docs/src/modules/utils/mapApiPageTranslations';
import jsonPageContent from './year-picker.json';

export default function Page(props) {
const { descriptions, pageContent } = props;
return <ApiPage descriptions={descriptions} pageContent={pageContent} />;
}

Page.getInitialProps = () => {
const req = require.context(
'docs/translations/api-docs/year-picker',
false,
/year-picker.*.json$/,
);
const descriptions = mapApiPageTranslations(req);

return {
descriptions,
pageContent: jsonPageContent,
};
};
15 changes: 15 additions & 0 deletions docs/pages/api-docs/year-picker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"props": {
"onYearChange": { "type": { "name": "func" } },
"shouldDisableYear": { "type": { "name": "func" } }
},
"name": "YearPicker",
"styles": { "classes": ["root"], "globalClasses": {}, "name": "MuiYearPicker" },
"spread": false,
"forwardsRefTo": "HTMLDivElement",
"filename": "/packages/material-ui-lab/src/YearPicker/YearPicker.tsx",
"inheritance": null,
"demos": "",
"styledComponent": false,
"cssComponent": false
}
1 change: 1 addition & 0 deletions docs/src/pagesApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,6 @@ module.exports = [
{ pathname: '/api-docs/tree-view' },
{ pathname: '/api-docs/typography' },
{ pathname: '/api-docs/unstable-trap-focus' },
{ pathname: '/api-docs/year-picker' },
{ pathname: '/api-docs/zoom' },
];
8 changes: 8 additions & 0 deletions docs/translations/api-docs/year-picker/year-picker-de.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"componentDescription": "",
"propDescriptions": {
"onYearChange": "Callback firing on year change @DateIOType.",
"shouldDisableYear": "Disable specific years dynamically. Works like <code>shouldDisableDate</code> but for year selection view. @DateIOType."
},
"classDescriptions": {}
}
8 changes: 8 additions & 0 deletions docs/translations/api-docs/year-picker/year-picker-es.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"componentDescription": "",
"propDescriptions": {
"onYearChange": "Callback firing on year change @DateIOType.",
"shouldDisableYear": "Disable specific years dynamically. Works like <code>shouldDisableDate</code> but for year selection view. @DateIOType."
},
"classDescriptions": {}
}
8 changes: 8 additions & 0 deletions docs/translations/api-docs/year-picker/year-picker-fr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"componentDescription": "",
"propDescriptions": {
"onYearChange": "Callback firing on year change @DateIOType.",
"shouldDisableYear": "Disable specific years dynamically. Works like <code>shouldDisableDate</code> but for year selection view. @DateIOType."
},
"classDescriptions": {}
}
8 changes: 8 additions & 0 deletions docs/translations/api-docs/year-picker/year-picker-ja.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"componentDescription": "",
"propDescriptions": {
"onYearChange": "Callback firing on year change @DateIOType.",
"shouldDisableYear": "Disable specific years dynamically. Works like <code>shouldDisableDate</code> but for year selection view. @DateIOType."
},
"classDescriptions": {}
}
8 changes: 8 additions & 0 deletions docs/translations/api-docs/year-picker/year-picker-pt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"componentDescription": "",
"propDescriptions": {
"onYearChange": "Callback firing on year change @DateIOType.",
"shouldDisableYear": "Disable specific years dynamically. Works like <code>shouldDisableDate</code> but for year selection view. @DateIOType."
},
"classDescriptions": {}
}
8 changes: 8 additions & 0 deletions docs/translations/api-docs/year-picker/year-picker-ru.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"componentDescription": "",
"propDescriptions": {
"onYearChange": "Callback firing on year change @DateIOType.",
"shouldDisableYear": "Disable specific years dynamically. Works like <code>shouldDisableDate</code> but for year selection view. @DateIOType."
},
"classDescriptions": {}
}
8 changes: 8 additions & 0 deletions docs/translations/api-docs/year-picker/year-picker-zh.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"componentDescription": "",
"propDescriptions": {
"onYearChange": "Callback firing on year change @DateIOType.",
"shouldDisableYear": "Disable specific years dynamically. Works like <code>shouldDisableDate</code> but for year selection view. @DateIOType."
},
"classDescriptions": {}
}
8 changes: 8 additions & 0 deletions docs/translations/api-docs/year-picker/year-picker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"componentDescription": "",
"propDescriptions": {
"onYearChange": "Callback firing on year change @DateIOType.",
"shouldDisableYear": "Disable specific years dynamically. Works like <code>shouldDisableDate</code> but for year selection view. @DateIOType."
},
"classDescriptions": {}
}
9 changes: 6 additions & 3 deletions packages/material-ui-lab/src/YearPicker/YearPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ export const styles: MuiStyles<YearPickerClassKey> = {
},
};

/**
* @ignore - do not document.
*/
const YearPicker = React.forwardRef(function YearPicker<TDate>(
props: YearPickerProps<TDate> & WithStyles<typeof styles>,
ref: React.Ref<HTMLDivElement>,
Expand Down Expand Up @@ -234,6 +231,12 @@ YearPicker.propTypes = {
shouldDisableYear: PropTypes.func,
} as any;

/**
*
* API:
*
* - [YearPicker API](https://material-ui.com/api/year-picker/)
*/
export default withStyles(styles, { name: 'MuiYearPicker' })(YearPicker) as <TDate>(
props: YearPickerProps<TDate> & React.RefAttributes<HTMLDivElement>,
) => JSX.Element;

0 comments on commit 3cd6f30

Please sign in to comment.