Skip to content

Commit 468bd68

Browse files
committed
Update to make carousel lazy load
1 parent 13bed4d commit 468bd68

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/components/Carousel.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import clsx from "clsx";
2-
import styles from "styles/components/Carousel.module.scss";
32
import { EmblaCarouselType } from "embla-carousel";
3+
import styles from "styles/components/Carousel.module.scss";
44

55
import { EmblaOptionsType } from "embla-carousel";
66
import useEmblaCarousel from "embla-carousel-react";
7+
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
78
import { ReactNode, useCallback, useEffect, useState } from "react";
89
import { Button } from "./Button";
9-
import { MarkdownContent } from "./MarkdownContent";
10-
import { ChevronLeft, ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
1110

1211
type PropType = {
1312
slides: ReactNode[];
@@ -22,7 +21,7 @@ type UsePrevNextButtonsType = {
2221
};
2322

2423
export const usePrevNextButtons = (
25-
emblaApi: EmblaCarouselType | undefined,
24+
emblaApi: EmblaCarouselType | undefined
2625
): UsePrevNextButtonsType => {
2726
const [prevBtnDisabled, setPrevBtnDisabled] = useState(true);
2827
const [nextBtnDisabled, setNextBtnDisabled] = useState(true);

src/components/ProjectSlide.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const ProjectSlide: React.FC<ProjectSlideProps> = ({
2222
}) => {
2323
return (
2424
<div className={clsx(styles.project_slide, className)}>
25-
<img src={image} alt={title} className={styles.project_slide__image} />
25+
<img loading="lazy" src={image} alt={title} className={styles.project_slide__image} />
2626

2727
<div className={clsx(styles.project_slide__content)}>
2828
<header className={styles.project_slide__header}>

0 commit comments

Comments
 (0)