braposo / react-responsive-picture

A future-proof responsive image component that supports latest Picture specification

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why glamor?

corysimmons opened this issue · comments

I don't understand why a dep is needed to polyfill ?

Hey @corysimmons, thanks for your question! It's actually something that I've been thinking about lately so it's perfect timing.

We use glamor because it's a peer dependency of glamorous, which we use mostly for the styling of the FullsizePicture component, but I agree that we can probably do better.

I think that having something like the FullsizePicture component is quite useful as it allows us to apply the same art direction that the Picture component has for background images.

So maybe using a lightweight framework like cxs instead of glamorous/glamor is a better solution for this package. What do you think?

I think just getting rid of the CSS-in-JS dep is preferable.

  1. I don't think a -in-React polyfill should be responsible for full viewport width styles.
  2. If you do want to add styles and such, use vanilla styles via style={{ ... }} prop?
  3. If you need media queries, I'm sure there's a vanilla way to do this as well with matchMedia.

Glamor(ous) has been removed in favour of cxs for the ´FullsizePicture´ component. The ´Picture´ component doesn't use any styling library so it will benefit from tree-shaking if it's used in isolation. The total size of the library has also dropped massively to 7.6Kb gzipped so the impact should be minimal.