artsy / palette

Artsy's design system
https://palette-storybook.artsy.net/
MIT License
215 stars 45 forks source link

feat: add support for placeHolderURL to Image #1359

Closed mzikherman closed 9 months ago

mzikherman commented 10 months ago

Instead of the canvas approach that's specific to blurhash, this adds support for placeHolderURL which when present, will include itself as a background image in the enclosing container. Tested as a canary locally w/ Force and it looks quite good IMO over in https://github.com/artsy/force/pull/13412. And b/c this behavior is gated behind passing in that prop, I think this might be mergeable/releasable.

When used with a data URL, as that's inlined the effect is an 'native' DOM render immediately, with the actual image fading in when it's loaded. The immediate DOM render of the placeholder is desired, as otherwise there's an 'extra' visible placeholder - first a grey-background 'skeleton' would load, then the placeholder, and then the final image.

📦 Published PR as canary version: Canary Versions
:sparkles: Test out this PR locally via: ```bash npm install @artsy/palette-charts@36.4.0-canary.1359.30146.0 npm install @artsy/palette@37.4.0-canary.1359.30146.0 # or yarn add @artsy/palette-charts@36.4.0-canary.1359.30146.0 yarn add @artsy/palette@37.4.0-canary.1359.30146.0 ```
mzikherman commented 9 months ago

Merging! I want with a name change at the end, dropping the 'blur' specificity in favor of placeHolderURL, since there really isn't anything blur-specific here, it's really just a placeholder (which likely should/will be used by clients via data URL, prob of the blurred version, etc.).

artsyit commented 9 months ago

:rocket: PR was released in @artsy/palette-charts@37.1.0, @artsy/palette@38.1.0 :rocket: