Skip to content

Commit

Permalink
fix(mon-pix): image figcaption always displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbertrand committed Mar 7, 2025
1 parent 62a4cf4 commit fe8f12c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions mon-pix/app/components/module/element/image.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,19 @@ export default class ModulixImageElement extends Component {
this.modalIsOpen = false;
}

get hasCaption() {
return this.args.image.legend?.length > 0 || this.args.image.licence?.length > 0;
}

<template>
<div class="element-image">
<figure class="element-image__container">
<img class="element-image-container__image" alt={{@image.alt}} src={{@image.url}} />
<figcaption class="element-image-container__caption">{{@image.legend}}<span
class="element-image-container__licence"
>{{@image.licence}}</span></figcaption>
{{#if this.hasCaption}}
<figcaption class="element-image-container__caption">{{@image.legend}}<span
class="element-image-container__licence"
>{{@image.licence}}</span></figcaption>
{{/if}}
</figure>
{{#if this.hasAlternativeText}}
<PixButton class="element-image__button" @variant="tertiary" @triggerAction={{this.showModal}}>
Expand Down

0 comments on commit fe8f12c

Please sign in to comment.