thunderstore-io / thunderstore-ui

Thunderstore React UI
11 stars 5 forks source link

@thunderstore/cyberstorm: add ImageWithFallback #975

Closed anttimaki closed 10 months ago

anttimaki commented 11 months ago

@thunderstore/cyberstorm: add ImageWithFallback

This component can be used with items that have an optional image field and thus are not guaranteed to actually have an image.

Creating a generic solution for the problem was commissioned, but it seems currently the only use case are the communities, since packages are guaranteed to have an associated image, and avatar use a different, letter-based approach which is already implemented.

The images currently use 3 / 4 aspect ratio and assumes the parent sets the width. This might not be very generic approach, but it works, at least for now.

Refs TS-1802

@thunderstore/cyberstorm: use ImageWithFallback in CommunityCard

Refs TS-1802

@thunderstore/cyberstorm: use ImageWithFallback in layout component

Refs TS-1802

@thunderstore/cyberstorm: remove CommunityImage

ImageWithFallback made this component obsolete.

Refs TS-1802

Remove obsolete fallback image

Games are guaranteed to have an "icon" image, so no fallback is needed.

Refs TS-1802

anttimaki commented 11 months ago

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.