Skip to content

Commit

Permalink
use size?: 'small' | 'medium'
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Feb 28, 2019
1 parent e4a139e commit f18c798
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 39 deletions.
2 changes: 1 addition & 1 deletion docs/src/pages/demos/tables/EnhancedTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ class EnhancedTable extends React.Component {
<Table
className={classes.table}
aria-labelledby="tableTitle"
size={dense ? 'small' : 'normal'}
size={dense ? 'small' : 'medium'}
>
<EnhancedTableHead
numSelected={selected.length}
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui/src/Table/Table.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export type TableBaseProps = React.TableHTMLAttributes<HTMLTableElement>;

export type Padding = 'default' | 'checkbox' | 'none';

export type Size = 'normal' | 'small';
export type Size = 'small' | 'medium';

export type TableClassKey = 'root';

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 @@ -51,13 +51,13 @@ Table.propTypes = {
/**
* Allows TableCells to inherit size of the Table.
*/
size: PropTypes.oneOf(['normal', 'small']),
size: PropTypes.oneOf(['small', 'medium']),
};

Table.defaultProps = {
component: 'table',
padding: 'default',
size: 'normal',
size: 'medium',
};

export default withStyles(styles, { name: 'MuiTable' })(Table);
2 changes: 1 addition & 1 deletion packages/material-ui/src/Table/Table.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe('<Table />', () => {
);

assert.deepStrictEqual(context, {
size: 'normal',
size: 'medium',
padding: 'default',
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui/src/TableCell/TableCell.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type TableCellBaseProps = React.ThHTMLAttributes<HTMLTableHeaderCellEleme

export type Padding = 'normal' | 'checkbox' | 'none';

export type Size = 'normal' | 'small';
export type Size = 'small' | 'medium';

export type SortDirection = 'asc' | 'desc' | false;

Expand Down
7 changes: 3 additions & 4 deletions packages/material-ui/src/TableCell/TableCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export const styles = theme => ({
/* Styles applied to the root element if `variant="body"` or `context.table.body`. */
body: {
color: theme.palette.text.primary,
// fontSize: theme.typography.pxToRem(13),
fontWeight: theme.typography.fontWeightRegular,
},
/* Styles applied to the root element if `variant="footer"` or `context.table.footer`. */
Expand Down Expand Up @@ -129,7 +128,7 @@ function TableCell(props) {
scope = 'col';
}
const padding = paddingProp || (table && table.padding ? table.padding : 'default');
const size = sizeProp || (table && table.size ? table.size : 'normal');
const size = sizeProp || (table && table.size ? table.size : 'medium');

let ariaSort = null;
if (sortDirection) {
Expand All @@ -148,7 +147,7 @@ function TableCell(props) {
: tablelvl2 && tablelvl2.variant === 'footer',
[classes[`align${capitalize(align)}`]]: align !== 'inherit',
[classes[`padding${capitalize(padding)}`]]: padding !== 'default',
[classes[`size${capitalize(size)}`]]: size !== 'normal',
[classes[`size${capitalize(size)}`]]: size !== 'medium',
},
className,
)}
Expand Down Expand Up @@ -200,7 +199,7 @@ TableCell.propTypes = {
* Specify the size of the cell.
* By default, the Table parent component set the value (`normal`).
*/
size: PropTypes.oneOf(['normal', 'small']),
size: PropTypes.oneOf(['small', 'medium']),
/**
* Set aria-sort direction.
*/
Expand Down
16 changes: 1 addition & 15 deletions pages/api/table-cell.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,10 @@ import TableCell from '@material-ui/core/TableCell';
| <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. |
<<<<<<< HEAD
| <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. |
| ~~<span class="prop-name">numeric</span>~~ | <span class="prop-type">bool</span> |   | *Deprecated*. Instead, use the `align` property.<br><br>If `true`, content will align to the right. |
| <span class="prop-name">padding</span> | <span class="prop-type">enum:&nbsp;'default'&nbsp;&#124;<br>&nbsp;'checkbox'&nbsp;&#124;<br>&nbsp;'dense'&nbsp;&#124;<br>&nbsp;'none'<br></span> |   | Sets the padding applied to the cell. By default, the Table parent component set the value. |
=======
| <span class="prop-name">component</span> | <span class="prop-type">element type</span> |   | The component used for the root node. Either a string to use a DOM element or a component. |
<<<<<<< HEAD
<<<<<<< HEAD
| <span class="prop-name">padding</span> | <span class="prop-type">enum:&nbsp;'normal', 'checkbox', 'dense', 'denseCheckbox', 'none'<br></span> |   | Sets the padding applied to the cell. By default, the Table parent component set the value. |
>>>>>>> Update docs
=======
| <span class="prop-name">padding</span> | <span class="prop-type">enum:&nbsp;'normal'&nbsp;&#124;<br>&nbsp;'checkbox'&nbsp;&#124;<br>&nbsp;'none'<br></span> |   | Sets the padding applied to the cell. By default, the Table parent component set the value. |
>>>>>>> Add a size prop the Table and drop denseCheckbox padding
=======
| <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> |   | Sets the padding applied to the cell. By default, the Table parent component set the value. |
>>>>>>> reduce amount of breaking change
| <span class="prop-name">scope</span> | <span class="prop-type">string</span> |   | Set scope attribute. |
| <span class="prop-name">size</span> | <span class="prop-type">enum:&nbsp;'normal'&nbsp;&#124;<br>&nbsp;'small'<br></span> |   | Specify the size of the cell. By default, the Table parent component set the value (`normal`). |
| <span class="prop-name">size</span> | <span class="prop-type">enum:&nbsp;'small'&nbsp;&#124;<br>&nbsp;'medium'<br></span> |   | Specify the size of the cell. By default, the Table parent component set the value (`normal`). |
| <span class="prop-name">sortDirection</span> | <span class="prop-type">enum:&nbsp;'asc'&nbsp;&#124;<br>&nbsp;'desc'&nbsp;&#124;<br>&nbsp;false<br></span> |   | Set aria-sort direction. |
| <span class="prop-name">variant</span> | <span class="prop-type">enum:&nbsp;'head'&nbsp;&#124;<br>&nbsp;'body'&nbsp;&#124;<br>&nbsp;'footer'<br></span> |   | Specify the cell type. By default, the TableHead, TableBody or TableFooter parent component set the value. |

Expand Down
15 changes: 1 addition & 14 deletions pages/api/table.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +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. |
<<<<<<< HEAD
| <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;'dense'&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">component</span> | <span class="prop-type">element type</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. |
<<<<<<< HEAD
<<<<<<< HEAD
| <span class="prop-name">padding</span> | <span class="prop-type">enum:&nbsp;'normal', 'checkbox', 'dense', 'none', 'denseCheckbox'<br></span> | <span class="prop-default">'normal'</span> | Allows TableCells to inherit padding of the Table. |
>>>>>>> Update docs
=======
| <span class="prop-name">padding</span> | <span class="prop-type">enum:&nbsp;'normal'&nbsp;&#124;<br>&nbsp;'checkbox'&nbsp;&#124;<br>&nbsp;'none'<br></span> | <span class="prop-default">'normal'</span> | Allows TableCells to inherit padding of the Table. |
=======
| <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. |
>>>>>>> reduce amount of breaking change
| <span class="prop-name">size</span> | <span class="prop-type">enum:&nbsp;'normal'&nbsp;&#124;<br>&nbsp;'small'<br></span> | <span class="prop-default">'normal'</span> | Allows TableCells to inherit size of the Table. |
>>>>>>> Add a size prop the Table and drop denseCheckbox padding
| <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 f18c798

Please sign in to comment.