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

Shadcn migration - image #13601

Merged
merged 2 commits into from
Aug 13, 2024
Merged

Shadcn migration - image #13601

merged 2 commits into from
Aug 13, 2024

Conversation

pettinarip
Copy link
Member

Description

Exports the default image component to be used in the UI transition.

Copy link

netlify bot commented Aug 7, 2024

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit cae511c
🔍 Latest deploy log https://app.netlify.com/sites/ethereumorg/deploys/66b4f319e26850000848ee54
😎 Deploy Preview https://deploy-preview-13601--ethereumorg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
7 paths audited
Performance: 44 (🔴 down 5 from production)
Accessibility: 93 (no change from production)
Best Practices: 91 (🔴 down 7 from production)
SEO: 92 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

* TODO: Rename this component to `Image` once all components are using Tailwind
*/
export const TwImage = (props: NextImageProps) => (
<DefaultNextImage {...props} />
Copy link
Member

@wackerow wackerow Aug 7, 2024

Choose a reason for hiding this comment

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

@pettinarip How do we want to handle any image sources that are external to the repo? Events, for example, will now be displaying external hosted images. To my knowledge, we have have a few options for rendering these:

  • Allowlist the image domain and use Next Image (which we wouldn't necessarily know)
  • Download the images in a separate task and import directly
  • Or just use the img element without the Next wrapper (foregoing any optimization Next offers)

Any thoughts on this, and do you think we should add a touch of logic here to differentiate the image source, and avoid the Next Image component if needed? Or should we just use img directly in those cases, and not bother importing this component? We currently get eslint @next/next/no-img-element warnings when doing this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question, I don't have an easy answer. I guess it depends.

Before I continue, I don't think this needs to be part of the scope of this PR. This PR just exports the default next image component to keep the current implementation and help with the UI transition.

  • If we know in advance where these images are coming from, I would lean towards adding these domains to the allowlist. But I would only do that in the case where we only have a few domains and we don't need to maintain too much (I would not expect that to happen).
  • Using the img seems like the easiest solution, but we lack optimizations & security.
  • and downloading images will require some prep work + maintaining the images...

So I would choose one of the following options:

  1. I would choose the first option if the domains are predefined and don't change.
  2. I would store the images in a separate cloud service and consume them from there (adding that to the allowlist).

@wackerow wackerow merged commit a3b6413 into dev Aug 13, 2024
8 of 10 checks passed
@wackerow wackerow deleted the shadcn-image branch August 13, 2024 22:34
This was referenced Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants