Material-ui: [Material-ui/Style v4.x] jss-extend plugin doesn't work properly ๐Ÿ‘€

Created on 6 Jun 2019  ยท  2Comments  ยท  Source: mui-org/material-ui

  • [x] I have searched the issues of this repository and believe that this is not a duplicate.
  • [x] This is not a v0.x issue.

Expected Behavior ๐Ÿค”

  button: {
    display: "block",
    borderRadius: "50px",
    "&::first-letter": {
      textTransform: "uppercase",
    }
  },
  buttonHighlight: {
    extend: "button", // set all button properties
    color: "grey"
  }

Component with buttonHighlight class should include all CSS properties from button class and his color should be grey.

Current Behavior ๐Ÿ˜ฏ

  button: {
    display: "block", โœ…
    borderRadius: "50px", โŒ
    "&::first-letter": {
      textTransform: "uppercase", โŒ
    }
  },
  buttonHighlight: {
    extend: "button",
    color: "grey"
  }

display property is correctly inherit from button to buttonHighlight but unfortunately, borderRadius and textTransform properties aren't passed to buttonHighlight class.
The &::first-letter property is passed directly to the component without any works. Here a screen from Chrome Developer tools.

mui-issue

I suppose that properties aren't parsed, so only property valid in CSS (like display in my example) will work.

Steps to Reproduce ๐Ÿ•น

Link: Code sandbox

Context ๐Ÿ”ฆ

I'm refactoring my code to use material-ui instead of my vanilla JSS solution. Everything works fine expect from my component which use the jss-extend plugin. This plugin worked properly with JSS only.

Your Environment ๐ŸŒŽ

| Tech | Version |
|--------------|---------|
| @material-ui/code | v4.0.1 |
| @material-ui/styles | v4.0.1 |
| jss-extend | v6.2.0 |
| react | v.16.8.6 |

question

Most helpful comment

You need to use JSS v10. https://codesandbox.io/s/condescending-cherry-pko8t

import jssExtend from "jss-plugin-extend";

const jss = create({
  plugins: [jssExtend(), ...jssPreset().plugins]
});

All 2 comments

You need to use JSS v10. https://codesandbox.io/s/condescending-cherry-pko8t

import jssExtend from "jss-plugin-extend";

const jss = create({
  plugins: [jssExtend(), ...jssPreset().plugins]
});

Thanks for your help!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amcasey picture amcasey  ยท  70Comments

illogikal picture illogikal  ยท  75Comments

celiao picture celiao  ยท  54Comments

chadobado picture chadobado  ยท  119Comments

sjstebbins picture sjstebbins  ยท  71Comments