0

Here is My Code

import { withStyles, MuiThemeProvider, createMuiTheme } from '@material-ui/core/styles';

import classNames from 'classnames';


const styles = theme => ({
    myGridStyle:{
        '&:.my-row-selected':{
            backgroundColor:"#ff9900 !important"
        }
    },
});

<div className={myGridStyle}> 
    <div role="row" class="my-row-selected" style="height: 30px;"></div>
</div>

I am using non material ui component for grid I want to apply style through Material UI withstyle and theme, so I have added withStyle for my parent div and i want to apply style for child div and child CSS classes.

Nitin Shinde
  • 1,154
  • 4
  • 16
  • 26

1 Answers1

0

You have several options, the newest is using the makeStyles hook, but you can use the withStyles HOC.

const styles = theme => ({
    myGridStyle: {
        '&:.my-row-selected':{
            backgroundColor:"#ff9900 !important"
        }
    },
});

function myGrid(props) {
  const { classes } = props;
  return (
    <div className={classes.myGridStyle}> 
        <div role="row" class="my-row-selected" style="height: 30px;"></div>
    </div>
  );
}

export default withStyles(styles)(myGrid);

https://material-ui.com/styles/basics/

Paul Redmond
  • 3,276
  • 4
  • 32
  • 52