ui icon indicating copy to clipboard operation
ui copied to clipboard

[Avatar] Integration with Nuxt Image for built in image optimization

Open GalacticHypernova opened this issue 1 year ago • 3 comments

Description

For elements like UAvatar that use images, it would be a good idea to integrate with Nuxt Image for those who have it installed to benefit from image optimizations like setting image format, applying modifiers, and all the other features that Nuxt Image offers.

Additional context

No response

GalacticHypernova avatar Aug 23 '24 15:08 GalacticHypernova

Duplicate #1577.

You can already do this using the as prop of the Avatar component:

<script setup>
const NuxtImg = resolveComponent('NuxtImg')
</script>

<template>
  <UAvatar src="https://github.com/benjamincanac.png" :as="NuxtImg" />
</template>

benjamincanac avatar Aug 23 '24 15:08 benjamincanac

@benjamincanac My apologies if it seemed as a duplicate, my suggestion was more so meant for automatic detection and usage of NuxtImg, not just plain capability (hence why I suggested integration as opposed to support). It would be a nice DX improvement in my opinion as it would simplify pages with a lot of avatars/other image elements.

GalacticHypernova avatar Aug 23 '24 17:08 GalacticHypernova

@GalacticHypernova Indeed, we could automatically use <NuxtImg> if installed. We can't do it yet in v3 because of nuxt/ui#2141, we'll have to wait for a fix in Radix Vue first.

benjamincanac avatar Sep 10 '24 20:09 benjamincanac