Add image number above caption in Hosted Gallery#16207
Conversation
|
Hello 👋! When you're ready to run Chromatic, please apply the You will need to reapply the label each time you want to run Chromatic. |
d3723a3 to
099df65
Compare
dskamiotis
left a comment
There was a problem hiding this comment.
This looks good to me Dina, nice move with the isHostedContent to be the gate the share button inclusion
099df65 to
40a7f7c
Compare
40a7f7c to
aa86282
Compare
cemms1
left a comment
There was a problem hiding this comment.
This is great! Though I think we can re-use position here instead of creating imageIndex for brevity. I left a comment explaining what I'm thinking. Let me know if you want to chat about it
| imagesLength?: number; | ||
| imageIndex?: number; |
There was a problem hiding this comment.
Shall we add a description to these props to indicate that they are only used to display the image number in hosted gallery pages?
| webTitle={webTitle} | ||
| position={image.position} | ||
| imagesLength={images?.length} | ||
| imageIndex={imageIndex} |
There was a problem hiding this comment.
we already have position so it might be worth trying to reuse that. The problem with position is that this takes into account mainMedia, which we omit in HostedGallery pages.
If we strip mainMedia out of the hosted gallery data (which we should do anyway as we throw it away at the rendering stage) we should be able to just use position here.
To do that, we'd add a condition to the enhance step to omit main media for hosted gallery pages
dotcom-rendering/dotcom-rendering/src/model/enhance-images.ts
Lines 424 to 460 in 7ee19c9
There was a problem hiding this comment.
@deedeeh I'm happy to do this in a separate PR, then you can use position in this PR to simplify things
dskamiotis
left a comment
There was a problem hiding this comment.
Nice refactor for the image position index - looks good to me 👍
| <figcaption css={styles}> | ||
| {isHostedGallery && | ||
| typeof position === 'number' && | ||
| imageIndex !== undefined && |
There was a problem hiding this comment.
nice approach, a bit easier to follow but still as affective 👍
What does this change?
This PR adds the image number above the caption in Hosted Content Gallery.
Tested locally with multiple Hosted Galleries and it works as expected.
Why?
Migrating Hosted Content to DCAR and Hosted Gallery is the last page to migrate. The new designs require this change.
Screenshots