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

SUL23-480: caption missing but really under the image #217

Merged
merged 3 commits into from
Sep 18, 2024

Conversation

jenbreese
Copy link
Contributor

@jenbreese jenbreese commented Sep 17, 2024

READY FOR REVIEW

Summary

  • The caption was on the page but hidden under the image. I didn't verify it wasn't on the page.
  • Possibly remove the fragment added?

Review By (Date)

  • 9/18

Criticality

  • Normal

Urgency

  • Normal

Review Tasks

Setup tasks and/or behavior to test

  1. Navigate to /news/stanford-libraries-make-nuremberg-international-military-tribunal-trial-archives-1945-1946
  2. Verify there is a visible caption
  3. Review the solution.

Site Configuration Sync

  • Is there a config:export in this PR that changes the config sync directory?

Front End Validation

Backend / Functional Validation

Code

  • Are the naming conventions following our standards?
  • Does the code have sufficient inline comments?
  • Is there anything in this code that would be hidden or hard to discover through the UI?
  • Are there any code smells?
  • Are tests provided? eg (unit, behat, or codeception)

Code security

General

  • Is there anything included in this PR that is not related to the problem it is trying to solve?
  • Is the approach to the problem appropriate?

Affected Projects or Products

  • Does this PR impact any particular projects, products, or modules?

Associated Issues and/or People

- SUL23-480

Resources

Copy link

vercel bot commented Sep 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
su-library ✅ Ready (Inspect) Visit Preview Sep 17, 2024 7:48pm

@@ -89,7 +89,7 @@ const StanfordNews = async ({node, ...props}: {node: NodeStanfordNews}) => {

{imageUrl && (
<figure className="relative mx-auto mb-100 aspect-[16/9] lg:w-10/12">
<Image className="object-cover" src={buildUrl(imageUrl).toString()} alt={imageAlt || ""} fill />
<Image className="!relative object-cover" src={buildUrl(imageUrl).toString()} alt={imageAlt || ""} fill />
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest staying away from !important uses, especially on the image component. NextJS Image component applies it's own styles that make it function the way it does for responsive sizes. My suggestion is to adjust the wrapper a little bit.:

<figure className="table">
  <span className="relative aspect-[16/9]">
     <Image .../>
  </span>
  <figcaption className="table-caption">...</figcaption>
</figure>

The <Image> component needs the immediate parent to be relative positioned. So changing this markup keeps that relative positioning but takes the caption out of it so the caption can be its own thing. You'll also notice the table classes. This can help with the positioning of the caption.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you. That's a good idea with the table class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pookmish I used caption instead of table-caption because of how it displays with a table.

<figure className="relative mx-auto mb-100 aspect-[16/9] lg:w-10/12">
<Image className="object-cover" src={buildUrl(imageUrl).toString()} alt={imageAlt || ""} fill />

<figure className="mb-100 table">
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
<figure className="mb-100 table">
<figure className="mb-100 table w-full">

<figure className="mb-100 table">
<span className="relative mx-auto block aspect-[16/9] lg:w-10/12">
<Image className="object-cover" src={buildUrl(imageUrl).toString()} alt={imageAlt || ""} fill />
</span>
{node.suNewsBannerMediaCaption && (
<figcaption className="caption text-center">{node.suNewsBannerMediaCaption}</figcaption>
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
<figcaption className="caption text-center">{node.suNewsBannerMediaCaption}</figcaption>
<figcaption className="table-caption caption-bottom text-center">{node.suNewsBannerMediaCaption}</figcaption>

{node.suNewsBannerMediaCaption && (
<figcaption className="caption text-center">{node.suNewsBannerMediaCaption}</figcaption>
)}
</figure>
)}

{node.suNewsBanner?.__typename === "MediaVideo" && (
<figure className="relative mx-auto mb-100 aspect-[16/9] w-10/12">
<Oembed url={node.suNewsBanner.mediaOembedVideo} />
<figure className="mb-100 table">
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
<figure className="mb-100 table">
<figure className="mb-100 table w-full">

<figure className="mb-100 table">
<span className="relative mx-auto block aspect-[16/9] w-10/12">
<Oembed url={node.suNewsBanner.mediaOembedVideo} />
</span>
{node.suNewsBannerMediaCaption && (
<figcaption className="caption text-center">{node.suNewsBannerMediaCaption}</figcaption>
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
<figcaption className="caption text-center">{node.suNewsBannerMediaCaption}</figcaption>
<figcaption className="table-caption caption-bottom text-center">{node.suNewsBannerMediaCaption}</figcaption>

@pookmish pookmish merged commit 297d719 into 1.x Sep 18, 2024
5 checks passed
@pookmish pookmish deleted the SUL23-480--banner-caption branch September 18, 2024 16:21
imonroe added a commit that referenced this pull request Oct 2, 2024
* SUL23-620: Corrected shared tags events view contextual filter argument name

* SUL23-593: Show list paragraph empty message if no results

* Add Image credit field on media image

* SUL23-480: caption missing but really under the image (#217)

* Removed the absolute

* fixup to table

* fixup

* Updated dependencies

* SUL23-481 | hardcode h3 headings for feature collections (#218)

* SUL23-481 | hardcode headings for feature collections

* adjust heading level for collections

* Improved invalidation when comparing the home page path

* Updated version in package.json

---------

Co-authored-by: Mike Decker <[email protected]>
Co-authored-by: Jen Breese <[email protected]>
Co-authored-by: Rebecca Hong <[email protected]>
imonroe added a commit that referenced this pull request Oct 2, 2024
* SUL23-620: Corrected shared tags events view contextual filter argument name

* SUL23-593: Show list paragraph empty message if no results

* Add Image credit field on media image

* SUL23-480: caption missing but really under the image (#217)

* Removed the absolute

* fixup to table

* fixup

* Updated dependencies

* SUL23-481 | hardcode h3 headings for feature collections (#218)

* SUL23-481 | hardcode headings for feature collections

* adjust heading level for collections

* Improved invalidation when comparing the home page path

---------

Co-authored-by: Mike Decker <[email protected]>
Co-authored-by: Jen Breese <[email protected]>
Co-authored-by: Rebecca Hong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants