Skip to content

Commit

Permalink
sebastian review
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Mar 25, 2019
1 parent 69734c2 commit f4b0d4d
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 21 deletions.
11 changes: 11 additions & 0 deletions docs/scripts/buildApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,17 @@ function buildDocs(options) {
throw err;
}

const docsDefaultProps = component.default.docsDefaultProps;
if (docsDefaultProps) {
Object.keys(reactAPI.props).forEach(key => {
if (docsDefaultProps.hasOwnProperty(key)) {
reactAPI.props[key].defaultValue = {
value: String(docsDefaultProps[key]),
};
}
});
}

reactAPI.name = name;
reactAPI.styles = styles;
reactAPI.pagesMarkdown = pagesMarkdown;
Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui/src/Table/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import useThemeProps from '../styles/useThemeProps';
import TableContext from './TableContext';
import muiComponent from '../utils/muiComponent';

const styles = {
export const styles = {
/* Styles applied to the root element. */
root: {
display: 'table',
Expand Down Expand Up @@ -73,7 +73,7 @@ Table.propTypes = {
};

if (process.env.NODE_ENV !== 'production') {
Table.defaultProps = {
Table.docsDefaultProps = {
component: 'table',
padding: 'default',
size: 'medium',
Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui/src/TableBody/TableBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const tablelvl2 = {
variant: 'body',
};

const styles = {
export const styles = {
/* Styles applied to the root element. */
root: {
display: 'table-row-group',
Expand Down Expand Up @@ -58,7 +58,7 @@ TableBody.propTypes = {
};

if (process.env.NODE_ENV !== 'production') {
TableBody.defaultProps = {
TableBody.docsDefaultProps = {
component: 'tbody',
};
}
Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui/src/TableCell/TableCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import TableContext from '../Table/TableContext';
import Tablelvl2Context from '../Table/Tablelvl2Context';
import muiComponent from '../utils/muiComponent';

const styles = theme => ({
export const styles = theme => ({
/* Styles applied to the root element. */
root: {
...theme.typography.body2,
Expand Down Expand Up @@ -219,7 +219,7 @@ TableCell.propTypes = {
};

if (process.env.NODE_ENV !== 'production') {
TableCell.defaultProps = {
TableCell.docsDefaultProps = {
align: 'inherit',
};
}
Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui/src/TableFooter/TableFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const tablelvl2 = {
variant: 'footer',
};

const styles = {
export const styles = {
/* Styles applied to the root element. */
root: {
display: 'table-footer-group',
Expand Down Expand Up @@ -58,7 +58,7 @@ TableFooter.propTypes = {
};

if (process.env.NODE_ENV !== 'production') {
TableFooter.defaultProps = {
TableFooter.docsDefaultProps = {
component: 'tfoot',
};
}
Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui/src/TableHead/TableHead.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const tablelvl2 = {
variant: 'head',
};

const styles = {
export const styles = {
/* Styles applied to the root element. */
root: {
display: 'table-header-group',
Expand Down Expand Up @@ -58,7 +58,7 @@ TableHead.propTypes = {
};

if (process.env.NODE_ENV !== 'production') {
TableHead.defaultProps = {
TableHead.docsDefaultProps = {
component: 'thead',
};
}
Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui/src/TableRow/TableRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import makeStyles from '../styles/makeStyles';
import Tablelvl2Context from '../Table/Tablelvl2Context';
import muiComponent from '../utils/muiComponent';

const styles = theme => ({
export const styles = theme => ({
/* Styles applied to the root element. */
root: {
color: 'inherit',
Expand Down Expand Up @@ -102,7 +102,7 @@ TableRow.propTypes = {
};

if (process.env.NODE_ENV !== 'production') {
TableRow.defaultProps = {
TableRow.docsDefaultProps = {
component: 'tr',
hover: false,
selected: false,
Expand Down
6 changes: 5 additions & 1 deletion packages/material-ui/src/internal/animate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ describe('animate', () => {

it('should work', done => {
container.scrollLeft = 200;
assert.strictEqual(container.scrollLeft, 200);
assert.strictEqual(
container.scrollLeft,
200,
`Fail with scrollWidth: ${container.scrollWidth}`,
);
animate('scrollLeft', container, 300, {}, err => {
assert.strictEqual(err, null);
assert.strictEqual(container.scrollLeft, 300);
Expand Down
2 changes: 1 addition & 1 deletion pages/api/table-body.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import TableBody from '@material-ui/core/TableBody';
|:-----|:-----|:--------|:------------|
| <span class="prop-name">children</span> | <span class="prop-type">node</span> |   | The content of the component, normally `TableRow`. |
| <span class="prop-name">classes</span> | <span class="prop-type">object</span> |   | Override or extend the styles applied to the component. See [CSS API](#css) below for more details. |
| <span class="prop-name">component</span> | <span class="prop-type">elementType</span> | <span class="prop-default">'tbody'</span> | The component used for the root node. Either a string to use a DOM element or a component. |
| <span class="prop-name">component</span> | <span class="prop-type">elementType</span> | <span class="prop-default">tbody</span> | The component used for the root node. Either a string to use a DOM element or a component. |

Any other properties supplied will be spread to the root element (native element).

Expand Down
2 changes: 1 addition & 1 deletion pages/api/table-cell.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import TableCell from '@material-ui/core/TableCell';

| Name | Type | Default | Description |
|:-----|:-----|:--------|:------------|
| <span class="prop-name">align</span> | <span class="prop-type">enum:&nbsp;'inherit', 'left', 'center', 'right', 'justify'<br></span> | <span class="prop-default">'inherit'</span> | Set the text-align on the table cell content.<br>Monetary or generally number fields **should be right aligned** as that allows you to add them up quickly in your head without having to worry about decimals. |
| <span class="prop-name">align</span> | <span class="prop-type">enum:&nbsp;'inherit', 'left', 'center', 'right', 'justify'<br></span> | <span class="prop-default">inherit</span> | Set the text-align on the table cell content.<br>Monetary or generally number fields **should be right aligned** as that allows you to add them up quickly in your head without having to worry about decimals. |
| <span class="prop-name">children</span> | <span class="prop-type">node</span> |   | The table cell contents. |
| <span class="prop-name">classes</span> | <span class="prop-type">object</span> |   | Override or extend the styles applied to the component. See [CSS API](#css) below for more details. |
| <span class="prop-name">component</span> | <span class="prop-type">elementType</span> |   | The component used for the root node. Either a string to use a DOM element or a component. |
Expand Down
2 changes: 1 addition & 1 deletion pages/api/table-footer.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import TableFooter from '@material-ui/core/TableFooter';
|:-----|:-----|:--------|:------------|
| <span class="prop-name">children</span> | <span class="prop-type">node</span> |   | The content of the component, normally `TableRow`. |
| <span class="prop-name">classes</span> | <span class="prop-type">object</span> |   | Override or extend the styles applied to the component. See [CSS API](#css) below for more details. |
| <span class="prop-name">component</span> | <span class="prop-type">elementType</span> | <span class="prop-default">'tfoot'</span> | The component used for the root node. Either a string to use a DOM element or a component. |
| <span class="prop-name">component</span> | <span class="prop-type">elementType</span> | <span class="prop-default">tfoot</span> | The component used for the root node. Either a string to use a DOM element or a component. |

Any other properties supplied will be spread to the root element (native element).

Expand Down
2 changes: 1 addition & 1 deletion pages/api/table-head.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import TableHead from '@material-ui/core/TableHead';
|:-----|:-----|:--------|:------------|
| <span class="prop-name">children</span> | <span class="prop-type">node</span> |   | The content of the component, normally `TableRow`. |
| <span class="prop-name">classes</span> | <span class="prop-type">object</span> |   | Override or extend the styles applied to the component. See [CSS API](#css) below for more details. |
| <span class="prop-name">component</span> | <span class="prop-type">elementType</span> | <span class="prop-default">'thead'</span> | The component used for the root node. Either a string to use a DOM element or a component. |
| <span class="prop-name">component</span> | <span class="prop-type">elementType</span> | <span class="prop-default">thead</span> | The component used for the root node. Either a string to use a DOM element or a component. |

Any other properties supplied will be spread to the root element (native element).

Expand Down
2 changes: 1 addition & 1 deletion pages/api/table-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ based on the material table element parent (head, body, etc).
|:-----|:-----|:--------|:------------|
| <span class="prop-name">children</span> | <span class="prop-type">node</span> |   | Should be valid &lt;tr> children such as `TableCell`. |
| <span class="prop-name">classes</span> | <span class="prop-type">object</span> |   | Override or extend the styles applied to the component. See [CSS API](#css) below for more details. |
| <span class="prop-name">component</span> | <span class="prop-type">elementType</span> | <span class="prop-default">'tr'</span> | The component used for the root node. Either a string to use a DOM element or a component. |
| <span class="prop-name">component</span> | <span class="prop-type">elementType</span> | <span class="prop-default">tr</span> | The component used for the root node. Either a string to use a DOM element or a component. |
| <span class="prop-name">hover</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | If `true`, the table row will shade on hover. |
| <span class="prop-name">selected</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | If `true`, the table row will have the selected shading. |

Expand Down
6 changes: 3 additions & 3 deletions pages/api/table.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import Table from '@material-ui/core/Table';
|:-----|:-----|:--------|:------------|
| <span class="prop-name required">children *</span> | <span class="prop-type">node</span> |   | The content of the table, normally `TableHead` and `TableBody`. |
| <span class="prop-name">classes</span> | <span class="prop-type">object</span> |   | Override or extend the styles applied to the component. See [CSS API](#css) below for more details. |
| <span class="prop-name">component</span> | <span class="prop-type">elementType</span> | <span class="prop-default">'table'</span> | The component used for the root node. Either a string to use a DOM element or a component. |
| <span class="prop-name">padding</span> | <span class="prop-type">enum:&nbsp;'default'&nbsp;&#124;<br>&nbsp;'checkbox'&nbsp;&#124;<br>&nbsp;'none'<br></span> | <span class="prop-default">'default'</span> | Allows TableCells to inherit padding of the Table. |
| <span class="prop-name">size</span> | <span class="prop-type">enum:&nbsp;'small'&nbsp;&#124;<br>&nbsp;'medium'<br></span> | <span class="prop-default">'medium'</span> | Allows TableCells to inherit size of the Table. |
| <span class="prop-name">component</span> | <span class="prop-type">elementType</span> | <span class="prop-default">table</span> | The component used for the root node. Either a string to use a DOM element or a component. |
| <span class="prop-name">padding</span> | <span class="prop-type">enum:&nbsp;'default'&nbsp;&#124;<br>&nbsp;'checkbox'&nbsp;&#124;<br>&nbsp;'none'<br></span> | <span class="prop-default">default</span> | Allows TableCells to inherit padding of the Table. |
| <span class="prop-name">size</span> | <span class="prop-type">enum:&nbsp;'small'&nbsp;&#124;<br>&nbsp;'medium'<br></span> | <span class="prop-default">medium</span> | Allows TableCells to inherit size of the Table. |

Any other properties supplied will be spread to the root element (native element).

Expand Down

0 comments on commit f4b0d4d

Please sign in to comment.