pimg
pimg copied to clipboard
Accept src as array in place of placeholder
Deprecate placeholder. Maybe? And use src={[imagePlaceholder,image]}.
hello, we want to deprecate placeholder to use array of imagePlaceholder and image right? Thanks in advance.
- Deprecating placeholder will still allow the use of placeholder but will warn if used, to be deprecated in the next major version.
- Src attribute will take an array of images or a string. The things to check for:
- One will have to check for the
typeof
src - If src is a string, we just assume the user doesn't want to pass a placeholder, and just renders the image although if it's a cloudinary image, we'll still lazy load it.
- If an array is passed to src, and the length is not 2, warn about not passing the right set of props.
- We'll still render the same placeholder for different srcset(s) as the placeholder is blurry. I might be the one to implement this tho.
- One will have to check for the
RFC
Normally, I would have said we should distinguish placeholders and the real images with a comma(,) as done is srcset. Just thought about the way it might look like if we decided to leave it that way. But, if done with arrays, it can easily extend to the next line with prettier.
Here now!!!