-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathindex.js
More file actions
84 lines (77 loc) · 1.94 KB
/
index.js
File metadata and controls
84 lines (77 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import React, { useState, useEffect } from "react";
import { Container, Row } from "../../../reusecore/Layout";
import SectionTitle from "../../../reusecore/SectionTitle";
import PartnerItemWrapper from "./partnerSection.style";
import { Link } from "gatsby";
import { partners } from "./partners-home-data";
import Slider from "react-slick";
const settings = {
initialSlide: 1,
lazyLoad: false,
arrows: false,
dots: false,
infinite: true,
speed: 500,
centerMode: true,
variableWidth: true,
autoplay: true,
autoplaySpeed: 1500,
className: "partner-slider",
responsive: [
{
breakpoint: 1400,
settings: "unslick",
},
],
};
const LazyPartnerImage = ({ partner }) => {
const [imageSrc, setImageSrc] = useState("");
useEffect(() => {
if (typeof partner.imageLink === "function") {
partner.imageLink().then((module) => {
setImageSrc(module.default);
});
} else {
setImageSrc(partner.imageLink);
}
}, [partner.imageLink]);
if (!imageSrc) return null;
return (
<img
className="partner-image"
id={partner.name}
loading="lazy"
src={imageSrc}
alt={partner.name}
width={partner.imageWidth}
height={partner.imageHeight}
/>
);
};
const Projects = () => {
return (
<PartnerItemWrapper>
<Container>
<Row>
<SectionTitle
className="section-title"
$leftAlign={true}
$UniWidth="75%"
>
<h4>ENGAGING AND COLLABORATING WITH</h4>
</SectionTitle>
</Row>
</Container>
<Slider {...settings}>
{partners.map((partner, index) => (
<Link className="partner-card" to={partner.imageRoute} key={index}>
<div className={partner.innerDivStyle}>
<LazyPartnerImage partner={partner} />
</div>
</Link>
))}
</Slider>
</PartnerItemWrapper>
);
};
export default Projects;