Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs on static image imports #26211

Merged
merged 3 commits into from Jun 16, 2021
Merged

Conversation

timneutkens
Copy link
Member

Incorporates some of the feedback we've had about this doc.

Bug

  • Related issues linked using fixes #number
  • Integration tests added

Feature

  • Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
  • Related issues linked using fixes #number
  • Integration tests added
  • Documentation added
  • Telemetry added. In case of a feature if it's used or not.

Documentation / Examples

  • Make sure the linting passes

ijjk
ijjk previously approved these changes Jun 16, 2021
Co-authored-by: Lachlan Campbell <lachlanjc@hey.com>
@kodiakhq kodiakhq bot merged commit 2967fe1 into vercel:canary Jun 16, 2021

You can `import` images that live in your project. (Note that `require` is not supported—only `import`.)

With direct `import`s, `width`, `height`, and `blurDataURL` will be automatically provided to the image component. Alt text is still needed separately.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's call it "static imports" instead of "direct imports" (I don't think we use direct anywhere else)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good flag!

Suggested change
With direct `import`s, `width`, `height`, and `blurDataURL` will be automatically provided to the image component. Alt text is still needed separately.
With static `import`s, `width`, `height`, and `blurDataURL` will be automatically provided to the image component. Alt text is still needed separately.

}
```

For dynamic images you have to provide `width`, `height` and `blurDataURL` manually.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be more clear if you define "dynamic image" which really means "src is a string"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For dynamic images you have to provide `width`, `height` and `blurDataURL` manually.
For images where you’re passing a URL to `src`, you have to provide `width`, `height` and `blurDataURL` manually.

flybayer pushed a commit to blitz-js/next.js that referenced this pull request Jun 24, 2021
Incorporates some of the feedback we've had about this doc.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants