Skip to content

Commit

Permalink
try the baseline on netlify
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Mar 23, 2019
1 parent 3c4afd4 commit 209795c
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 126 deletions.
24 changes: 4 additions & 20 deletions packages/material-ui/src/Table/Table.js
@@ -1,8 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import makeStyles from '../styles/makeStyles';
import useThemeProps from '../styles/useThemeProps';
import withStyles from '../styles/withStyles';
import TableContext from './TableContext';

export const styles = {
Expand All @@ -15,18 +14,8 @@ export const styles = {
},
};

export const useStyles = makeStyles(styles, { name: 'MuiTable' });

const Table = React.forwardRef(function Table(props, ref) {
const {
classes: classesProp,
className,
component: Component,
padding,
size,
...other
} = useThemeProps(props, { name: 'MuiTable' });
const classes = useStyles(props);
const { classes, className, component: Component, padding, size, ...other } = props;
const table = React.useMemo(() => ({ padding, size }), [padding, size]);

return (
Expand All @@ -45,7 +34,7 @@ Table.propTypes = {
* Override or extend the styles applied to the component.
* See [CSS API](#css) below for more details.
*/
classes: PropTypes.object,
classes: PropTypes.object.isRequired,
/**
* @ignore
*/
Expand Down Expand Up @@ -76,9 +65,4 @@ Table.defaultProps = {
size: 'medium',
};

Table.useStyles = useStyles;
Table.options = {
name: 'MuiTable',
};

export default Table;
export default withStyles(styles, { name: 'MuiTable' })(Table);
25 changes: 7 additions & 18 deletions packages/material-ui/src/TableBody/TableBody.js
@@ -1,28 +1,22 @@
import React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import makeStyles from '../styles/makeStyles';
import useThemeProps from '../styles/useThemeProps';
import withStyles from '../styles/withStyles';
import Tablelvl2Context from '../Table/Tablelvl2Context';

const tablelvl2 = {
variant: 'body',
};

export const styles = {
/* Styles applied to the root element. */
root: {
display: 'table-row-group',
},
};

const useStyles = makeStyles(styles, { name: 'MuiTableBody' });
const tablelvl2 = {
variant: 'body',
};

const TableBody = React.forwardRef(function TableBody(props, ref) {
const { classes: classesProp, className, component: Component, ...other } = useThemeProps(props, {
name: 'MuiTableBody',
});
const classes = useStyles(props);
const { classes, className, component: Component, ...other } = props;

return (
<Tablelvl2Context.Provider value={tablelvl2}>
Expand All @@ -40,7 +34,7 @@ TableBody.propTypes = {
* Override or extend the styles applied to the component.
* See [CSS API](#css) below for more details.
*/
classes: PropTypes.object,
classes: PropTypes.object.isRequired,
/**
* @ignore
*/
Expand All @@ -56,9 +50,4 @@ TableBody.defaultProps = {
component: 'tbody',
};

TableBody.useStyles = useStyles;
TableBody.options = {
name: 'MuiTableBody',
};

export default TableBody;
export default withStyles(styles, { name: 'MuiTableBody' })(TableBody);
19 changes: 5 additions & 14 deletions packages/material-ui/src/TableCell/TableCell.js
@@ -1,8 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import makeStyles from '../styles/makeStyles';
import useThemeProps from '../styles/useThemeProps';
import withStyles from '../styles/withStyles';
import { capitalize } from '../utils/helpers';
import { darken, fade, lighten } from '../styles/colorManipulator';
import TableContext from '../Table/TableContext';
Expand Down Expand Up @@ -99,13 +98,11 @@ export const styles = theme => ({
},
});

const useStyles = makeStyles(styles, { name: 'MuiTableCell' });

const TableCell = React.forwardRef(function TableCell(props, ref) {
const {
align,
children,
classes: classesProp,
classes,
className,
component,
padding: paddingProp,
Expand All @@ -114,9 +111,8 @@ const TableCell = React.forwardRef(function TableCell(props, ref) {
sortDirection,
variant,
...other
} = useThemeProps(props, { name: 'MuiTableCell' });
} = props;

const classes = useStyles(props);
const table = React.useContext(TableContext);
const tablelvl2 = React.useContext(Tablelvl2Context);

Expand Down Expand Up @@ -181,7 +177,7 @@ TableCell.propTypes = {
* Override or extend the styles applied to the component.
* See [CSS API](#css) below for more details.
*/
classes: PropTypes.object,
classes: PropTypes.object.isRequired,
/**
* @ignore
*/
Expand Down Expand Up @@ -220,9 +216,4 @@ TableCell.defaultProps = {
align: 'inherit',
};

TableCell.useStyles = useStyles;
TableCell.options = {
name: 'MuiTableCell',
};

export default TableCell;
export default withStyles(styles, { name: 'MuiTableCell' })(TableCell);
25 changes: 7 additions & 18 deletions packages/material-ui/src/TableFooter/TableFooter.js
@@ -1,28 +1,22 @@
import React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import makeStyles from '../styles/makeStyles';
import useThemeProps from '../styles/useThemeProps';
import withStyles from '../styles/withStyles';
import Tablelvl2Context from '../Table/Tablelvl2Context';

const tablelvl2 = {
variant: 'footer',
};

export const styles = {
/* Styles applied to the root element. */
root: {
display: 'table-footer-group',
},
};

const useStyles = makeStyles(styles, { name: 'MuiTableFooter' });
const tablelvl2 = {
variant: 'footer',
};

const TableFooter = React.forwardRef(function TableFooter(props, ref) {
const { classes: classesProp, className, component: Component, ...other } = useThemeProps(props, {
name: 'MuiTableFooter',
});
const classes = useStyles(props);
const { classes, className, component: Component, ...other } = props;

return (
<Tablelvl2Context.Provider value={tablelvl2}>
Expand All @@ -40,7 +34,7 @@ TableFooter.propTypes = {
* Override or extend the styles applied to the component.
* See [CSS API](#css) below for more details.
*/
classes: PropTypes.object,
classes: PropTypes.object.isRequired,
/**
* @ignore
*/
Expand All @@ -56,9 +50,4 @@ TableFooter.defaultProps = {
component: 'tfoot',
};

TableFooter.useStyles = useStyles;
TableFooter.options = {
name: 'MuiTableFooter',
};

export default TableFooter;
export default withStyles(styles, { name: 'MuiTableFooter' })(TableFooter);
25 changes: 7 additions & 18 deletions packages/material-ui/src/TableHead/TableHead.js
@@ -1,28 +1,22 @@
import React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import makeStyles from '../styles/makeStyles';
import useThemeProps from '../styles/useThemeProps';
import withStyles from '../styles/withStyles';
import Tablelvl2Context from '../Table/Tablelvl2Context';

const tablelvl2 = {
variant: 'head',
};

export const styles = {
/* Styles applied to the root element. */
root: {
display: 'table-header-group',
},
};

const useStyles = makeStyles(styles, { name: 'MuiTableHead' });
const tablelvl2 = {
variant: 'head',
};

const TableHead = React.forwardRef(function TableHead(props, ref) {
const { classes: classesProp, className, component: Component, ...other } = useThemeProps(props, {
name: 'MuiTableHead',
});
const classes = useStyles(props);
const { classes, className, component: Component, ...other } = props;

return (
<Tablelvl2Context.Provider value={tablelvl2}>
Expand All @@ -40,7 +34,7 @@ TableHead.propTypes = {
* Override or extend the styles applied to the component.
* See [CSS API](#css) below for more details.
*/
classes: PropTypes.object,
classes: PropTypes.object.isRequired,
/**
* @ignore
*/
Expand All @@ -56,9 +50,4 @@ TableHead.defaultProps = {
component: 'thead',
};

TableHead.useStyles = useStyles;
TableHead.options = {
name: 'MuiTableHead',
};

export default TableHead;
export default withStyles(styles, { name: 'MuiTableHead' })(TableHead);
23 changes: 4 additions & 19 deletions packages/material-ui/src/TableRow/TableRow.js
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import makeStyles from '../styles/makeStyles';
import withStyles from '../styles/withStyles';
import Tablelvl2Context from '../Table/Tablelvl2Context';

export const styles = theme => ({
Expand Down Expand Up @@ -35,23 +35,13 @@ export const styles = theme => ({
footer: {},
});

const useStyles = makeStyles(styles, { name: 'MuiTableRow' });

/**
* Will automatically set dynamic row height
* based on the material table element parent (head, body, etc).
*/
const TableRow = React.forwardRef(function TableRow(props, ref) {
const {
classes: classesProp,
className,
component: Component,
hover,
selected,
...other
} = props;
const { classes, className, component: Component, hover, selected, ...other } = props;
const tablelvl2 = React.useContext(Tablelvl2Context);
const classes = useStyles(props);

return (
<Component
Expand Down Expand Up @@ -80,7 +70,7 @@ TableRow.propTypes = {
* Override or extend the styles applied to the component.
* See [CSS API](#css) below for more details.
*/
classes: PropTypes.object,
classes: PropTypes.object.isRequired,
/**
* @ignore
*/
Expand All @@ -106,9 +96,4 @@ TableRow.defaultProps = {
selected: false,
};

TableRow.useStyles = useStyles;
TableRow.options = {
name: 'MuiTableRow',
};

export default TableRow;
export default withStyles(styles, { name: 'MuiTableRow' })(TableRow);
19 changes: 5 additions & 14 deletions packages/material-ui/src/TableSortLabel/TableSortLabel.js
Expand Up @@ -4,8 +4,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import ArrowDownwardIcon from '../internal/svg-icons/ArrowDownward';
import makeStyles from '../styles/makeStyles';
import useThemeProps from '../styles/useThemeProps';
import withStyles from '../styles/withStyles';
import ButtonBase from '../ButtonBase';
import { capitalize } from '../utils/helpers';

Expand Down Expand Up @@ -60,23 +59,20 @@ export const styles = theme => ({
},
});

const useStyles = makeStyles(styles, { name: 'MuiTableSortLabel' });

/**
* A button based label for placing inside `TableCell` for column sorting.
*/
const TableSortLabel = React.forwardRef(function TableSortLabel(props, ref) {
const {
active,
children,
classes: classesProp,
classes,
className,
direction,
hideSortIcon,
IconComponent,
...other
} = useThemeProps(props, { name: 'MuiTableSortLabel' });
const classes = useStyles(props);
} = props;

return (
<ButtonBase
Expand Down Expand Up @@ -109,7 +105,7 @@ TableSortLabel.propTypes = {
* Override or extend the styles applied to the component.
* See [CSS API](#css) below for more details.
*/
classes: PropTypes.object,
classes: PropTypes.object.isRequired,
/**
* @ignore
*/
Expand All @@ -135,9 +131,4 @@ TableSortLabel.defaultProps = {
IconComponent: ArrowDownwardIcon,
};

TableSortLabel.useStyles = useStyles;
TableSortLabel.options = {
name: 'MuiTableSortLabel',
};

export default TableSortLabel;
export default withStyles(styles, { name: 'MuiTableSortLabel' })(TableSortLabel);
1 change: 0 additions & 1 deletion packages/material-ui/src/styles/index.js
Expand Up @@ -6,6 +6,5 @@ export { default as MuiThemeProvider } from './MuiThemeProvider';
export { default as styled } from './styled';
export * from './transitions';
export { default as useTheme } from './useTheme';
export { default as useThemeProps } from './useThemeProps';
export { default as withStyles } from './withStyles';
export { default as withTheme } from './withTheme';

0 comments on commit 209795c

Please sign in to comment.