Skip to content

Commit

Permalink
Production bug, trying to at least not start at height 0.
Browse files Browse the repository at this point in the history
  • Loading branch information
LutherTS committed Sep 11, 2024
1 parent 49ac757 commit 4454510
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions app/(pages)/carousel-part-cleaned/carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,13 @@ export default function Carousel({ images }: { images: string[] }) {
else paramsingObjectFitting();
});

let height = useMotionValue(0);
const { width } = useWindowSize();
const { width, height } = useWindowSize();
let scrollHeight = useMotionValue(height);

useEffect(() => {
height.set(document.getElementById(`${IMAGEID + index}`)!.clientHeight);
scrollHeight.set(
document.getElementById(`${IMAGEID + index}`)!.clientHeight,
);
}, [index, objectFitting, width]);

/* NEXT UP WOULD BE:
Expand All @@ -173,7 +176,7 @@ export default function Carousel({ images }: { images: string[] }) {
className={`flex`}
animate={{ x: `-${index * 100}%` }}
style={{
height: objectFitting === "scroll" ? height : "auto",
height: objectFitting === "scroll" ? scrollHeight : "auto",
}}
>
{images.map((imageUrl, i) => {
Expand Down
2 changes: 1 addition & 1 deletion app/(pages)/carousel-part-cleaned/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ let images: string[];
// ]);
// imagesForSorting.sort((a, b) => a[1] - b[1]);
// images = imagesForSorting.map((e) => e[0]);
// // console.log(images);
// console.log(images);

/* Replacing the copypasted multiple images. */
const imagesDynamized = (x: number) => {
Expand Down

0 comments on commit 4454510

Please sign in to comment.