|
1 | 1 | import React from 'react';
|
2 |
| -import logocloudStyles from './logocloud.module.css'; |
| 2 | +import { StaticQuery, graphql } from 'gatsby'; |
3 | 3 |
|
| 4 | +import logocloudStyles from './logocloud.module.css'; |
4 | 5 |
|
5 |
| -export default function LogoCloud() { |
6 |
| - const logos = [{ |
7 |
| - src: "https://raw.githubusercontent.com/openclimatefix/website/master/src/images/sponsor_esa.png", |
8 |
| - href: "#" |
9 |
| - }, { |
10 |
| - src: "https://raw.githubusercontent.com/openclimatefix/website/master/src/images/sponsor_raais.png", |
11 |
| - href: "#" |
12 |
| - }, { |
13 |
| - src: "https://camo.githubusercontent.com/1abc6e2b23f17a79a55ee991e6981e46cf338695/68747470733a2f2f63646e2e737667706f726e2e636f6d2f6c6f676f732f7a65706c696e2e737667", |
14 |
| - href: "#" |
15 |
| - }, { |
16 |
| - src: "https://camo.githubusercontent.com/6de73ae841384e69cf10c444cc63022655649a6c/68747470733a2f2f63646e2e737667706f726e2e636f6d2f6c6f676f732f73656d616e7469632d7765622e737667", |
17 |
| - href: "#" |
18 |
| - }, { |
19 |
| - src: "https://camo.githubusercontent.com/deeb3fdf4ccc12c58598858c8a9b96aed919c044/68747470733a2f2f63646e2e737667706f726e2e636f6d2f6c6f676f732f6170707369676e616c2e737667", |
20 |
| - href: "#" |
21 |
| - }, { |
22 |
| - src: "https://raw.githubusercontent.com/openclimatefix/website/master/src/images/sponsor_esa.png", |
23 |
| - href: "#" |
24 |
| - }, { |
25 |
| - src: "https://raw.githubusercontent.com/openclimatefix/website/master/src/images/sponsor_esa.png", |
26 |
| - href: "#" |
27 |
| - }, { |
28 |
| - src: "https://raw.githubusercontent.com/openclimatefix/website/master/src/images/sponsor_esa.png", |
29 |
| - href: "#" |
30 |
| - }, { |
31 |
| - src: "https://raw.githubusercontent.com/openclimatefix/website/master/src/images/sponsor_esa.png", |
32 |
| - href: "#" |
33 |
| - }, { |
34 |
| - src: "https://raw.githubusercontent.com/openclimatefix/website/master/src/images/sponsor_esa.png", |
35 |
| - href: "#" |
36 |
| - }]; |
| 6 | +export default function LogoCloud({ logos }) { |
| 7 | + const LOGOS = logos || [ |
| 8 | + { |
| 9 | + name: 'ESA Business Applications', |
| 10 | + image: 'esa_space_solutions.png', |
| 11 | + link: 'https://business.esa.int/', |
| 12 | + }, |
| 13 | + { |
| 14 | + name: 'Open Data Institute', |
| 15 | + image: 'odi.png', |
| 16 | + link: 'https://theodi.org/', |
| 17 | + }, |
| 18 | + { |
| 19 | + name: 'The Alan Turing Institute', |
| 20 | + image: 'turing.png', |
| 21 | + link: 'https://www.turing.ac.uk/', |
| 22 | + }, |
| 23 | + { |
| 24 | + name: 'The Climate Subak', |
| 25 | + image: 'subak.png', |
| 26 | + link: 'https://www.subak.org/', |
| 27 | + }, |
| 28 | + { |
| 29 | + name: 'Machine Intelligence Garage', |
| 30 | + image: 'MI-Garage_Badge_cohort.png', |
| 31 | + link: 'https://www.migarage.ai/', |
| 32 | + }, |
| 33 | + { |
| 34 | + name: 'RAAIS Foundation', |
| 35 | + image: 'raais_foundation.png', |
| 36 | + link: 'https://www.raais.org/', |
| 37 | + }, |
| 38 | + { |
| 39 | + name: 'HAO', |
| 40 | + image: 'hao_black.png', |
| 41 | + link: 'https://haocreative.ca/', |
| 42 | + }, |
| 43 | + { |
| 44 | + name: 'Icebreaker One', |
| 45 | + image: 'icebreakerOneURL.png', |
| 46 | + link: 'https://icebreakerone.org/', |
| 47 | + }, |
| 48 | + ]; |
37 | 49 |
|
38 | 50 | return (
|
39 |
| - <div className={logocloudStyles.logogrid}> |
40 |
| - {logos.map(({src, href}, index) => ( |
41 |
| - <a key={`logo-${index}`} href={href}><img src={src} /></a> |
42 |
| - ))} |
43 |
| - </div> |
| 51 | + <StaticQuery |
| 52 | + query={graphql` |
| 53 | + query LogosQuery { |
| 54 | + allFile(filter: { relativeDirectory: { eq: "logos" } }) { |
| 55 | + edges { |
| 56 | + node { |
| 57 | + relativePath |
| 58 | + childImageSharp { |
| 59 | + fluid(maxWidth: 300, maxHeight: 250) { |
| 60 | + ...GatsbyImageSharpFluid |
| 61 | + } |
| 62 | + fixed(width: 300) { |
| 63 | + ...GatsbyImageSharpFixed |
| 64 | + } |
| 65 | + } |
| 66 | + } |
| 67 | + } |
| 68 | + } |
| 69 | + } |
| 70 | + `} |
| 71 | + render={data => ( |
| 72 | + <div className={logocloudStyles.logogrid}> |
| 73 | + {LOGOS.map(({ name, image, link }) => { |
| 74 | + const img = data.allFile.edges.find(({ node }) => |
| 75 | + node.relativePath.endsWith(image) |
| 76 | + ).node; |
| 77 | + |
| 78 | + return ( |
| 79 | + <a key={`logo-${name}`} href={link} type="button"> |
| 80 | + <img |
| 81 | + src={img.childImageSharp.fixed.src} |
| 82 | + title={name} |
| 83 | + alt={`Logo for ${name}`} |
| 84 | + style={{ filter: 'grayscale(100%)' }} |
| 85 | + /> |
| 86 | + </a> |
| 87 | + ); |
| 88 | + })} |
| 89 | + </div> |
| 90 | + )} |
| 91 | + /> |
44 | 92 | );
|
45 | 93 | }
|
0 commit comments