Browse Source

display kind 20 alt text

imwald
Silberengel 3 days ago
parent
commit
fb10548d61
  1. 1
      src/components/Image/index.tsx
  2. 7
      src/components/ImageGallery/index.tsx
  3. 7
      src/components/ImageWithLightbox/index.tsx

1
src/components/Image/index.tsx

@ -128,6 +128,7 @@ export default function Image({ @@ -128,6 +128,7 @@ export default function Image({
<img
src={imageUrl}
alt={finalAlt}
title={finalAlt || undefined}
decoding="async"
loading="lazy"
draggable={false}

7
src/components/ImageGallery/index.tsx

@ -7,7 +7,9 @@ import { TImetaInfo } from '@/types' @@ -7,7 +7,9 @@ import { TImetaInfo } from '@/types'
import { ReactNode, useEffect, useMemo, useState } from 'react'
import { createPortal } from 'react-dom'
import Lightbox from 'yet-another-react-lightbox'
import Captions from 'yet-another-react-lightbox/plugins/captions'
import Zoom from 'yet-another-react-lightbox/plugins/zoom'
import 'yet-another-react-lightbox/plugins/captions.css'
import Image from '../Image'
import ImageWithLightbox from '../ImageWithLightbox'
@ -112,12 +114,13 @@ export default function ImageGallery({ @@ -112,12 +114,13 @@ export default function ImageGallery({
slides={(() => {
const slides = images.map(({ url, alt }) => ({
src: url,
alt: alt || url
alt: alt || url,
title: alt || undefined
}))
logger.debug('[ImageGallery] Lightbox slides:', { index, slidesCount: slides.length, slides })
return slides
})()}
plugins={[Zoom]}
plugins={[Zoom, Captions]}
open={index >= 0}
close={() => setIndex(-1)}
controller={{

7
src/components/ImageWithLightbox/index.tsx

@ -7,7 +7,9 @@ import { useEffect, useMemo, useState } from 'react' @@ -7,7 +7,9 @@ import { useEffect, useMemo, useState } from 'react'
import { createPortal } from 'react-dom'
import { useTranslation } from 'react-i18next'
import Lightbox from 'yet-another-react-lightbox'
import Captions from 'yet-another-react-lightbox/plugins/captions'
import Zoom from 'yet-another-react-lightbox/plugins/zoom'
import 'yet-another-react-lightbox/plugins/captions.css'
import Image from '../Image'
export default function ImageWithLightbox({
@ -75,9 +77,10 @@ export default function ImageWithLightbox({ @@ -75,9 +77,10 @@ export default function ImageWithLightbox({
index={index}
slides={[{
src: image.url,
alt: image.alt || image.url
alt: image.alt || image.url,
title: image.alt || undefined
}]}
plugins={[Zoom]}
plugins={[Zoom, Captions]}
open={index >= 0}
close={() => setIndex(-1)}
controller={{

Loading…
Cancel
Save