ant-design / ant-design-icons

⭐ Ant Design SVG Icons
https://ant.design/components/icon/
MIT License
939 stars 577 forks source link

Cascade Layers support #644

Open tim-richter opened 1 month ago

tim-richter commented 1 month ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Since antd introduced a way to apply cascade layers to their styles (https://ant.design/docs/react/compatible-style#layer-downgrade), I was wondering, if we could support this for the icons as well.

Currently all of the injected styles from this library would have a higher specificity, then antd styles, if used together with layer. This could cause specificity issues in the long run. It would also make it easier for antd users, to use icons in their projects, if those would automatically get the same specificity layer as antd styles.

I could see two possible solutions to this:

Let me know which solutions would work best and if I can help with any of those.

skycrazyk commented 1 month ago

There is already problem with icons when using @layer. @ant-design/icons has more specific styles and overrides antd styles.

I reproduced the problem on stackblitz https://stackblitz.com/edit/vitejs-vite-cdw4gw?file=src%2FApp.tsx

image

image

tim-richter commented 4 weeks ago

@vagusX @MadCcc @afc163 Sorry for tagging here, but thanks to the reproduction from @skycrazyk, I guess there are already specificity problems with the icons library, and I think this should be fixed rather sooner than later.