Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default class is not merged when using react #152

Open
santiagocezar opened this issue Jan 21, 2022 · 0 comments
Open

Default class is not merged when using react #152

santiagocezar opened this issue Jan 21, 2022 · 0 comments

Comments

@santiagocezar
Copy link

santiagocezar commented Jan 21, 2022

Similar to issue #53, but React not Vue.

Setting classNameon a icon component overrides the default class set in the config. This is because inside the declaration the className prop is set to $defaultClass, but after that props is spread and overrides className

This is how the declaration kinda looks (got it via console.logging the component)

const icOutlineShoppingCart = (props) => /* @__PURE__ */ _jsxDEV("svg", {
  style: {
    color: "red"
  },
  className: "my-default-class",
  ...props,
  // ...
});

IMO it should be something like

const icOutlineShoppingCart = ({className, style, ...props}) => /* @__PURE__ */ _jsxDEV("svg", {
  style: {
    color: "red"
    ...(style || {}) // might be undefined
  },
  className: "my-default-class" + " " + (className || ""), // could be undefined too 
  ...props,
  // ...
});
@santiagocezar santiagocezar changed the title Merge default class when using react Default class is not merged when using react Jan 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant