feat(nuxt-img): add custom slot for full control of rendering#1626
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1626 +/- ##
==========================================
- Coverage 62.87% 62.78% -0.09%
==========================================
Files 79 79
Lines 3539 3547 +8
Branches 413 413
==========================================
+ Hits 2225 2227 +2
- Misses 1285 1291 +6
Partials 29 29 ☔ View full report in Codecov by Sentry. |
|
I added the custom prop which acts similarly to the NuxtLink custom prop. I also updated the docs to show how to create custom placeholders with it. |
danielroe
left a comment
There was a problem hiding this comment.
Great - this is very promising!
Would you be able to add some tests? 🙏
|
I'll be honest, I'm fairly new to unit testing, but I have some experience with Cypress. I added a test to check if the placeholder functionality and attribute fallthrough work as expected when the custom prop is set, and it seems they do. |
|
@danielroe is this okay or should I add more tests? |
| ...imgAttrs, | ||
| ...attrs, | ||
| }, | ||
| isLoaded: isImageLoaded, |
There was a problem hiding this comment.
this looks perfect now, just one change - I think let's not expose isImageLoaded as this can be misleading - on server load the load may take place before hydration and this will never end up being set to true
There was a problem hiding this comment.
if it's significant, we could also open a new PR to implement the functionality - maybe through an approach similar to error handling?
custom slot for full control of rendering
🔗 Linked issue
resolves #1307
❓ Type of change
📚 Description
This PR add a placeholder slot for NuxtImg component