image icon indicating copy to clipboard operation
image copied to clipboard

docs: supplement responsive usage

Open a1mersnow opened this issue 1 year ago โ€ข 2 comments

โ“ Type of change

  • [x] ๐Ÿ“– Documentation (updates to the documentation or readme)
  • [ ] ๐Ÿž Bug fix (a non-breaking change that fixes an issue)
  • [ ] ๐Ÿ‘Œ Enhancement (improving an existing functionality)
  • [ ] โœจ New feature (a non-breaking change that adds functionality)
  • [ ] ๐Ÿงน Chore (updates to the build process or auxiliary tools and libraries)
  • [ ] โš ๏ธ Breaking change (fix or feature that would cause existing functionality to change)

๐Ÿ“š Description

Try to help beginners use <NuxtImg>'s responsive features.

I changed the example below <NuxtImg>'s sizes property:

<!-- before -->
<NuxtImg
  src="/logos/nuxt.png"
  sizes="100vw sm:50vw md:400px"
/>
<!-- after -->
<NuxtImg
  src="/logos/nuxt.png"
  sizes="300px sm:50vw md:400px"
/>

And I recommend giving a pixel value for the default size.

If you use 100vw as the default size, you will get srcsets of 1w and 2w which do not make sense.

a1mersnow avatar Dec 20 '24 01:12 a1mersnow

Open in StackBlitz

npm i https://pkg.pr.new/@nuxt/image@1642

commit: 1ad4292

pkg-pr-new[bot] avatar Apr 24 '25 13:04 pkg-pr-new[bot]

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 7.02%. Comparing base (62998ab) to head (1ad4292). :warning: Report is 1 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #1642   +/-   ##
=====================================
  Coverage   7.02%   7.02%           
=====================================
  Files         77      77           
  Lines       3575    3575           
  Branches     138     138           
=====================================
  Hits         251     251           
  Misses      3276    3276           
  Partials      48      48           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov-commenter avatar Apr 24 '25 13:04 codecov-commenter