From a02085624ab15b699c5bd6a3c00a90d2ca1e4e76 Mon Sep 17 00:00:00 2001 From: jaytula Date: Tue, 20 Aug 2019 22:41:52 -0700 Subject: [PATCH] Change to useStyles for CardContentInner comopnent --- .../src/layout/CardContentInner.js | 48 +++++++++++-------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/packages/ra-ui-materialui/src/layout/CardContentInner.js b/packages/ra-ui-materialui/src/layout/CardContentInner.js index ba345c9881f..8be249cdbe8 100644 --- a/packages/ra-ui-materialui/src/layout/CardContentInner.js +++ b/packages/ra-ui-materialui/src/layout/CardContentInner.js @@ -2,24 +2,23 @@ import React from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; import CardContent from '@material-ui/core/CardContent'; -import { withStyles, createStyles } from '@material-ui/core/styles'; +import { makeStyles } from '@material-ui/core/styles'; -var styles = theme => - createStyles({ - root: { - paddingTop: 0, - paddingBottom: 0, - '&:first-child': { - paddingTop: 16, - }, - '&:last-child': { - paddingBottom: 16, - [theme.breakpoints.only('xs')]: { - paddingBottom: 70, - }, +var useStyles = makeStyles(theme => ({ + root: { + paddingTop: 0, + paddingBottom: 0, + '&:first-child': { + paddingTop: 16, + }, + '&:last-child': { + paddingBottom: 16, + [theme.breakpoints.only('xs')]: { + paddingBottom: 70, }, }, - }); + }, +})); /** * Overrides material-ui CardContent to allow inner content @@ -28,11 +27,18 @@ var styles = theme => * padding double the spacing between each CardContent, leading to too much * wasted space. Use this component as a CardContent alternative. */ -const CardContentInner = ({ classes, className, children }) => ( - - {children} - -); +const CardContentInner = ({ + classes: classesOverride, + className, + children, +}) => { + const classes = useStyles({ classes: classesOverride }); + return ( + + {children} + + ); +}; CardContentInner.propTypes = { className: PropTypes.string, @@ -40,4 +46,4 @@ CardContentInner.propTypes = { children: PropTypes.node, }; -export default withStyles(styles)(CardContentInner); +export default CardContentInner;