-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathPartnerMarquee.jsx
More file actions
92 lines (82 loc) · 2.08 KB
/
PartnerMarquee.jsx
File metadata and controls
92 lines (82 loc) · 2.08 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
85
86
87
88
89
90
91
92
import React, { useRef } from "react"
import Image from "gatsby-image/withIEPolyfill"
import useFixedPartnerLogos from "../../utils/queries/useFixedPartnerLogos"
import Partners from "../../utils/data/Partners.json"
import Ticker from "react-ticker"
import styled from "@emotion/styled"
const PartnerLogo = ({ partner, urls }) => {
const { images } = useFixedPartnerLogos()
console.log(images)
const logoFile = images.edges.find(
(img) => img.node.name === partner.toLowerCase()
)
const source = logoFile.node.childImageSharp.fixed
const LogoContainer = styled("div")`
width: full;
margin-left: 1em;
margin-right: 1em;
`
return (
<LogoContainer className={`w-full mx-3 mt-2 mb-3`}>
<a href={urls}>
<Image
className={`ticker`}
fixed={source}
objectFit="contain"
objectPosition="center"
alt={`${partner} icon`}
/>
</a>
</LogoContainer>
)
}
const TickerContainer = styled("div")`
display: flex;
flex-direction: row;
overflow: hidden;
align-items: center;
`
const LeftFog = styled("div")`
position: absolute;
top: 0;
left: -1px;
bottom: 0;
width: 47px;
background: linear-gradient(90deg, #fff, hsla(0, 0%, 100%, 0));
`
const RightFog = styled("div")`
position: absolute;
top: 0;
right: -1px;
bottom: 0;
width: 47px;
background: linear-gradient(270deg, #fff, hsla(0, 0%, 100%, 0));
`
const PartnerMarqueeContainer = styled("div")`
position: relative;
text-align: center;
`
const PartnerMarquee = ({ partner }) => {
const partners = useRef(Partners)
return (
<PartnerMarqueeContainer>
<h3>Educational Partners</h3>
<Ticker>
{() => (
<TickerContainer>
{partners.current.map((partner, index) => (
<PartnerLogo
partner={partner.partner}
urls={partner.url}
key={index}
/>
))}
</TickerContainer>
)}
</Ticker>
<RightFog />
<LeftFog />
</PartnerMarqueeContainer>
)
}
export default PartnerMarquee