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

Export VPImage as global component #2813

Closed
4 tasks done
kleisauke opened this issue Aug 18, 2023 · 2 comments · Fixed by #2814
Closed
4 tasks done

Export VPImage as global component #2813

kleisauke opened this issue Aug 18, 2023 · 2 comments · Fixed by #2814
Labels
contribution welcome The team would welcome a contribution from the community for this issue enhancement New feature or request theme Related to the theme

Comments

@kleisauke
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Exporting VPImage as a global component, just like VPBadge, would be really helpful. This approach would allow a different image to be chosen depending on whether dark or light mode is used.

For example:

<Image alt="Logo" :image="{ light: '/logo.svg', dark: '/logo-dark.svg' }" />

Describe the solution you'd like

Export VPImage as global Image component, see e.g. commit kleisauke@f1b6a57.

Describe alternatives you've considered

I considered to use this:

<picture>
  <source srcset="/logo-dark.svg" media="(prefers-color-scheme: dark)" />
  <img src="/logo.svg" alt="Logo" />
</picture>

However, this approach wouldn't work if a user manually switches to dark mode.

Additional context

I could open a PR for commit kleisauke@f1b6a57, if appropriate.

Validations

@brc-dd
Copy link
Member

brc-dd commented Aug 18, 2023

Contributions are welcome, but don't add that globally. Export it like this: #2767

People who want it to be global, can just import and register in their enhanceApp.

@brc-dd brc-dd added enhancement New feature or request theme Related to the theme contribution welcome The team would welcome a contribution from the community for this issue labels Aug 18, 2023
@kleisauke
Copy link
Contributor Author

Ah, that makes sense. I just opened PR #2814 for this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
contribution welcome The team would welcome a contribution from the community for this issue enhancement New feature or request theme Related to the theme
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants