diff options
Diffstat (limited to 'src/views/Gallery.js')
| -rw-r--r-- | src/views/Gallery.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/views/Gallery.js b/src/views/Gallery.js index e2652df..7681e3b 100644 --- a/src/views/Gallery.js +++ b/src/views/Gallery.js @@ -5,7 +5,7 @@ import React, { useState, useEffect } from "react"; import { mod } from "../utils/index.js"; -export default function Gallery({ images, visible }) { +export default function Gallery({ images, visible, onLoad }) { const hasItems = !!images?.length; const oneItem = images?.length === 1; @@ -15,26 +15,31 @@ export default function Gallery({ images, visible }) { setIndex(0); setOpacity(0); setTimeout(() => setOpacity(1), 500); + onLoad(); }, [images]); function previous() { setOpacity(0); + onLoad(); setTimeout(() => setIndex(mod(index - 1, images.length)), 200); // setTimeout(() => setOpacity(1), 500); } function next() { setOpacity(0); + onLoad(); setTimeout(() => setIndex(mod(index + 1, images.length)), 200); // setTimeout(() => setOpacity(1), 500); } function nextOrWrap() { if (oneItem) return; setOpacity(0); + onLoad(); setTimeout(() => setIndex(mod(index + 1, images.length)), 200); // setTimeout(() => setOpacity(1), 500); } function appear() { setOpacity(1); + onLoad(); } if (!hasItems) { @@ -53,7 +58,7 @@ export default function Gallery({ images, visible }) { /> )} </div> - <div className="buttons"> + <div className="buttons arrows"> {!oneItem && ( <img src="/assets/img/arrow-back.svg" |
