extend style material UI

后端 未结 1 673
终归单人心
终归单人心 2020-12-22 01:20

is there way to extend style on reactjs I tried extend style but its dosent work

cellItem:{
 color: \"black\",
    fontWeight: \"bold\",
    [theme.breakp         


        
相关标签:
1条回答
  • 2020-12-22 01:56

    You can just use JavaScript features for this:

    const styles = theme => {
      const cellItem = {
        color: "black",
        fontWeight: "bold",
        [theme.breakpoints.down("xs")]: {
          fontSize: "0.8em"
        }
      };
      return {
        cellItem,
        tableCellItem: {
          ...cellItem,
          fontSize: "1.5em"
        },
        tableCellItemInSingleScreen: {
          ...cellItem,
          fontSize: "2.5em"
        }
      };
    };
    
    

    There is an extend plugin within JSS that would cause your syntax to work, but it is not one of the plugins included within Material-UI by default, but you can add that plugin.

    Related answer: Advanced styling in material-ui

    0 讨论(0)
提交回复
热议问题