Skip to content
New issue

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

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

Already on GitHub? # to your account

#320 Refactor images #396

Merged
merged 9 commits into from
Feb 11, 2025
Merged

Conversation

katarinazaprazna
Copy link
Contributor

Description

  • Replace MImage and img tags with StrapiImage and Image (from Next)
  • Ensure that images fill their parent containers where appropriate (using fill property of StrapiImage and wrapping the image into div with defined dimensions)

Testing

Browse the site and ensure that images are displayed correctly, such as no image is missing, is cropped, or strangely stretched

Changes were made at:

  • / (to see NoticeCard)
  • /zazite/podujatia
  • /zazite/podujatia/konverzujeme-po-anglicky-3-2-25
  • /error (stránka sa nenašla)
  • /zazite/prenajmite-si-priestor (to see BranchCard)
  • /sluzby/vzdelavanie/clanky (to see BlogPostCard)
  • /sluzby/vzdelavanie/clanky/efektivne-sluzby-kniznice-pre-sucasnu-spolocnost-priklady-z-praxe
  • /o-nas/partneri-a-spoluprace (to see PartnerCardRow)
  • Content containing markdown (richtext) e.g., /o-nas/z-historie
  • /navstivte/nase-lokality/klariska (to see ImageGallery and ImageLightBox)

@@ -4,6 +4,7 @@
"allCategories": "All categories",
"answer.no": "No",
"answer.yes": "Yes",
"blogPostPage.guestName": "Guest name",
Copy link
Contributor

Choose a reason for hiding this comment

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

I found the missing translation key - it was just incorrectly named before. It is eventDetails.eventGuests. Please use this one and remove "blogPostPage.guestName", also in the slovak translation. Sorry for additional misdirection.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see now. Noted :)

Copy link
Contributor

Choose a reason for hiding this comment

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

I am sorry, now I see that the advice i gave you was wrong. the eventDetails.eventGuests just says "Účinkujú" and then there's a list of guests, for which we need an alt in their profile picture. We can discuss this in person :)

Copy link
Contributor

Choose a reason for hiding this comment

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

why this change?

Copy link
Contributor Author

@katarinazaprazna katarinazaprazna Feb 10, 2025

Choose a reason for hiding this comment

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

That's part of the "remove object-center when it's not necessary" task. There was a div with className object-center and the entire div was deleted - it was there (only) so that object-center could be applied, I assume

Copy link
Contributor

Choose a reason for hiding this comment

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

The original comment was meant for that specific line of code. This change may be ok, but it slows the review process.

@katarinazaprazna katarinazaprazna force-pushed the 320/techdebt-refactor-nextjs-images branch 2 times, most recently from 8c18a1c to 52dcf6e Compare February 10, 2025 16:33
@katarinazaprazna katarinazaprazna force-pushed the 320/techdebt-refactor-nextjs-images branch from 52dcf6e to 1290b0b Compare February 10, 2025 16:49
Copy link
Contributor

@Ty-ci Ty-ci left a comment

Choose a reason for hiding this comment

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

Review still ongoing, but I am submitting at least some comments

<div className="relative w-full shrink-0 md:h-75 lg:h-[400px]">
<StrapiImage
image={bannerImage || getImagePlaceholder(EventDetailPlaceholder)}
alt={bannerImage?.alternativeText}
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
alt={bannerImage?.alternativeText}
alt={bannerImage?.alternativeText ?? ""}

based on the recent image alt clarification, this seems to be the right solution (it follows our approach for richtext images)

Copy link
Contributor

@Ty-ci Ty-ci left a comment

Choose a reason for hiding this comment

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

🙌 good job!

Please adress the new alt comments, otherwise good to go.

<div className="relative h-40.5 w-full shrink-0">
<StrapiImage
image={listingImage || coverImage || getImagePlaceholder()}
alt={listingImage?.alternativeText || coverImage?.alternativeText}
Copy link
Contributor

Choose a reason for hiding this comment

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

Now I realize that this is a decorational image as per our docs. It had an empty alt before, so it should remain. Sorry about that confusion when we discussed this

<div className="relative mb-4 h-40.5 w-full shrink-0">
<StrapiImage
image={coverMedia?.data?.attributes ?? getImagePlaceholder()}
fill
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
fill
fill
alt=""

Now I realize that this is a decorational image as per our docs. It had an empty alt before, so it should remain. Sorry about that confusion when we discussed this

<div className="relative mb-4 h-40.5 w-full shrink-0">
<StrapiImage
image={image?.attributes ?? getImagePlaceholder()}
fill
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
fill
fill
alt=""

Now I realize that this is a decorational image as per our docs. It had an empty alt before, so it should remain. Sorry about that confusion when we discussed this

@github-actions github-actions bot added pr: fix & ship 🚢 No additional review needed before merge - some work may be required, if specified in last review and removed pr: needs review 🙏 labels Feb 11, 2025
Copy link

github-actions bot commented Feb 11, 2025

Test build pipeline info 🚀

Changes in the code and tag info:

➡️ Changes in strapi: false

➡️ Changes in next: true

We are going to build 🚢

🔜 next

🥳 Bratiska-cli successfully built an image from path: next/

@katarinazaprazna katarinazaprazna merged commit 67f22d9 into master Feb 11, 2025
4 checks passed
@katarinazaprazna katarinazaprazna deleted the 320/techdebt-refactor-nextjs-images branch February 11, 2025 12:16
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
pr: fix & ship 🚢 No additional review needed before merge - some work may be required, if specified in last review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TechDebt: Refactor Next.js Images to StrapiImage
2 participants