diff --git a/src/components/media.jsx b/src/components/media.jsx index f8e2ead3..943db1e0 100644 --- a/src/components/media.jsx +++ b/src/components/media.jsx @@ -1,4 +1,5 @@ import { getBlurHashAverageColor } from 'fast-blurhash'; +import { Fragment } from 'preact'; import { useCallback, useLayoutEffect, @@ -251,90 +252,104 @@ function Media({ media, to, showOriginal, autoAnimate, onClick = () => {} }) { > `; + const showInlineDesc = !showOriginal && !isGIF && !!description; + const Container = showInlineDesc ? 'figure' : Fragment; + return ( - { - if (hoverAnimate) { - try { - videoRef.current.pause(); - } catch (e) {} - } - onClick(e); - }} - onMouseEnter={() => { - if (hoverAnimate) { - try { - videoRef.current.play(); - } catch (e) {} - } - }} - onMouseLeave={() => { - if (hoverAnimate) { - try { - videoRef.current.pause(); - } catch (e) {} - } - }} - > - {showOriginal || autoGIFAnimate ? ( - isGIF && showOriginal ? ( - + + { + if (hoverAnimate) { + try { + videoRef.current.pause(); + } catch (e) {} + } + onClick(e); + }} + onMouseEnter={() => { + if (hoverAnimate) { + try { + videoRef.current.play(); + } catch (e) {} + } + }} + onMouseLeave={() => { + if (hoverAnimate) { + try { + videoRef.current.pause(); + } catch (e) {} + } + }} + > + {showOriginal || autoGIFAnimate ? ( + isGIF && showOriginal ? ( + +
+ + ) : (
- - ) : ( -
- ) - ) : isGIF ? ( -