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

DEV-16534: WebC Figure image refactor #885

Merged
merged 9 commits into from Dec 8, 2023
Merged

Conversation

anderspollack
Copy link
Contributor

@anderspollack anderspollack commented Dec 5, 2023

This adds:

  • _components/quire-figure.webc: defines a <figure> with an id and conditionally renders figureAudio, figureTable, figureVideo, and figureImageWebc
  • _components/figure-image.webc: conditionally renders <canvas-panel>, <image-sequence>, <image-service>, and <image-tag> components based on mediaType. Registered as an eleventy shortcode named figureImageWebc
  • _components/image-tag.webc: renders a <img> tag with alt text

Note: Media embed links in video/audio figures are currently rendering in web output; these links should only show in print output. Image Sequences still need to be addressed as well -- see https://jira.getty.edu/browse/DEV-16542

@mphstudios I was originally planning on doing these figure image component webc refactors in isolation, but refactoring the _plugins/shortcodes/figure.js to render quire-figure.webc ended up being much simpler -- we can still use the JS components for video, audio, and table figures via @html="...". Interestingly enough, none of these actually need the quire-data JSON since we can just use our getFigure(id) filter -- I anticipate that will still be necessary / useful for refactoring the lightbox/modal.

@anderspollack anderspollack marked this pull request as ready for review December 6, 2023 03:43
@mphstudios mphstudios self-requested a review December 6, 2023 18:18
Comment on lines +1 to +6
<template webc:nokeep>
<canvas-panel webc:if="isCanvas(id)" @attributes="attributes(id, image_dir).canvasPanel"></canvas-panel>
<image-service webc:elseif="isImageService(id)" @attributes="attributes(id, image_dir).imageService"></image-service>
<image-sequence webc:elseif="isSequence(id)" @attributes="attributes(id, image_dir).imageSequence"></image-sequence>
<image-tag webc:else @attributes="attributes(id, image_dir).imageTag"></image-tag>
</template>
Copy link
Member

Choose a reason for hiding this comment

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

Could the template be written using a dynamic webc component, webc:is="component(id)", rather than a webc conditional statements?

Copy link
Member

@mphstudios mphstudios Dec 6, 2023

Choose a reason for hiding this comment

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

Apparently webc:is does not support dynamic values; see 11ty/webc#143

Copy link
Member

Choose a reason for hiding this comment

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

We might add a comment on the implementation quirks, something like

<!--- 
  Nota bene: `webc:is` does not support dynamic values (see 11ty/webc#143);
  use webc conditional statements and call the `attributes` function multiple times rather than using a fancier pattern of implementation.
--->

Co-authored-by: matthew p hrudka <mphstudios@users.noreply.github.com>
@anderspollack anderspollack merged commit 9097d30 into main Dec 8, 2023
@anderspollack anderspollack deleted the feature/DEV-16534 branch December 8, 2023 00:15
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.

None yet

2 participants