Skip to content

Commit 80d3cd5

Browse files
authored
Merge pull request #105 from CivicDataLab/dev
Dev
2 parents 0db9d78 + a1588dc commit 80d3cd5

9 files changed

Lines changed: 437 additions & 287 deletions

File tree

content/team/akhil/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ github: https://github.com/akkisagiraju
88
twitter:
99
linkedin: https://www.linkedin.com/in/akhil-sagiraju
1010
image: akhil.jpeg
11-
sectors: Law & Justice
11+
sectors: Law & Justice, Education, Urban Planning
1212
projects: Justice Hub, Zombie Tracker, OpenCity, The Northern Alliance of Scotland
1313
---
1414

package-lock.json

Lines changed: 280 additions & 173 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
"react-dom": "^16.12.0",
2525
"react-helmet": "^5.2.1",
2626
"react-icons": "^4.1.0",
27-
"react-indiana-drag-scroll": "^1.8.1",
2827
"react-multi-carousel": "^2.6.2",
2928
"react-reveal": "^1.2.2",
3029
"rss-parser": "^3.10.0",

src/components/AboutBackground.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const AboutBackground = ({ children }) => {
3333
}, [data.allFile.nodes]);
3434

3535
return (
36-
<BackgroundImage fluid={currentImage}>
36+
<BackgroundImage style={{ zIndex: 999 }} fluid={currentImage}>
3737
{children}
3838
</BackgroundImage>
3939
);

src/components/CivicDaysImages.js

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,62 @@
11
import React from 'react';
22
import Image from 'gatsby-image';
33
import BackgroundImage from 'gatsby-background-image';
4-
import ScrollContainer from 'react-indiana-drag-scroll';
4+
import Carousel from 'react-multi-carousel';
5+
import 'react-multi-carousel/lib/styles.css';
56
import { graphql, useStaticQuery } from 'gatsby';
67
import styled from 'styled-components';
7-
import useHorizontalAutoScroll from '../hooks/useHorizontalAutoScroll';
88

9-
const StyledScrollContainer = styled(ScrollContainer)`
10-
display: flex;
11-
align-items: center;
12-
overflow-x: auto;
9+
const StyledCarousel = styled(Carousel)`
1310
height: 380px;
14-
margin-bottom: 60px;
11+
margin-bottom: 36px;
1512
16-
> * {
13+
ul > * {
1714
height: 260px;
1815
width: 260px;
19-
margin-right: 20px;
20-
flex-shrink: 0;
16+
}
17+
18+
.gatsby-image-wrapper {
19+
height: 100%;
20+
width: 100%;
2121
}
2222
2323
@media (min-width: 1280px) {
24-
margin-bottom: 90px;
24+
margin-bottom: 80px;
25+
26+
li {
27+
margin-right: 20px;
28+
}
2529
}
2630
2731
@media (min-width: 2000px) {
2832
height: 480px;
2933
30-
> * {
34+
ul > * {
3135
height: 350px;
3236
width: 350px;
3337
}
3438
}
3539
`;
3640

41+
const responsive = {
42+
superLargeDesktop: {
43+
breakpoint: { max: 4000, min: 2000 },
44+
items: 8
45+
},
46+
desktop: {
47+
breakpoint: { max: 2000, min: 1024 },
48+
items: 5
49+
},
50+
tablet: {
51+
breakpoint: { max: 1024, min: 464 },
52+
items: 3
53+
},
54+
mobile: {
55+
breakpoint: { max: 464, min: 0 },
56+
items: 1
57+
}
58+
};
59+
3760
const CivicDaysImages = () => {
3861
const data = useStaticQuery(graphql`
3962
query {
@@ -61,17 +84,13 @@ const CivicDaysImages = () => {
6184
}
6285
`);
6386

64-
const scrollContainer = React.useRef(null);
65-
66-
useHorizontalAutoScroll(scrollContainer);
67-
6887
return (
6988
<BackgroundImage fluid={data.file.childImageSharp.fluid}>
70-
<StyledScrollContainer innerRef={scrollContainer} vertical={false}>
89+
<StyledCarousel infinite autoPlay autoPlaySpeed={2000} responsive={responsive}>
7190
{data.civicdayimages.nodes?.map((image) => {
7291
return <Image key={image.id} fluid={image.childImageSharp.fluid} />;
7392
})}
74-
</StyledScrollContainer>
93+
</StyledCarousel>
7594
</BackgroundImage>
7695
);
7796
};

src/components/Layout/Navbar.js

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -199,25 +199,6 @@ export const navLinks = [
199199
];
200200

201201
const Navbar = ({ dark, overlay }) => {
202-
const [displayMobileNav, setDisplayMobileNav] = React.useState(false);
203-
const navbarRef = React.useRef(null);
204-
205-
React.useEffect(() => {
206-
const addFixedClass = () => {
207-
if (window.scrollY > 50) {
208-
navbarRef.current.classList.add('fixed');
209-
} else {
210-
navbarRef.current.classList.remove('fixed');
211-
}
212-
};
213-
214-
window.addEventListener('scroll', addFixedClass);
215-
216-
return () => {
217-
window.removeEventListener('scroll', addFixedClass);
218-
};
219-
}, []);
220-
221202
const data = useStaticQuery(graphql`
222203
query LogoQuery {
223204
logo: file(relativePath: { eq: "cdl_logo.png" }) {
@@ -237,13 +218,34 @@ const Navbar = ({ dark, overlay }) => {
237218
}
238219
`);
239220

240-
const logo = data?.logo?.childImageSharp.fluid;
241-
const darkLogo = data?.darkLogo?.childImageSharp.fluid;
221+
const [displayMobileNav, setDisplayMobileNav] = React.useState(false);
222+
const [navBarLogo, setNavBarLogo] = React.useState(
223+
dark ? data.darkLogo.childImageSharp.fluid : data.logo.childImageSharp.fluid
224+
);
225+
const navbarRef = React.useRef(null);
226+
227+
React.useEffect(() => {
228+
const addFixedClass = () => {
229+
if (window.scrollY > 50) {
230+
navbarRef.current.classList.add('fixed');
231+
setNavBarLogo(data.logo.childImageSharp.fluid);
232+
} else {
233+
navbarRef.current.classList.remove('fixed');
234+
setNavBarLogo(dark ? data.darkLogo.childImageSharp.fluid : data.logo.childImageSharp.fluid);
235+
}
236+
};
237+
238+
window.addEventListener('scroll', addFixedClass);
239+
240+
return () => {
241+
window.removeEventListener('scroll', addFixedClass);
242+
};
243+
}, [data.logo.childImageSharp.fluid, data.darkLogo.childImageSharp.fluid, dark]);
242244

243245
return (
244246
<StyledNav ref={navbarRef} overlay={overlay}>
245247
<Link to="/">
246-
<Image fluid={dark ? darkLogo : logo} />
248+
<Image fluid={navBarLogo} />
247249
</Link>
248250
<MdMenu onClick={() => setDisplayMobileNav(true)} className="mobile-nav" />
249251
<LinksContainer dark={dark} displayMobile={displayMobileNav}>

src/components/OurPartners.js

Lines changed: 92 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,107 @@
11
import React from 'react';
22
import HeroText from '../styles/HeroText';
3-
import OurPartnersStyle from '../styles/OurPartners';
43
import Image from 'gatsby-image';
5-
import ScrollContainer from 'react-indiana-drag-scroll';
4+
import styled from 'styled-components';
5+
import Carousel from 'react-multi-carousel';
6+
import 'react-multi-carousel/lib/styles.css';
67
import MainContainer from '../styles/MainContainer';
78
import useHorizontalAutoScroll from '../hooks/useHorizontalAutoScroll';
89

10+
const responsive = {
11+
superLargeDesktop: {
12+
breakpoint: { max: 4000, min: 2000 },
13+
items: 12
14+
},
15+
desktop: {
16+
breakpoint: { max: 2000, min: 1024 },
17+
items: 8
18+
},
19+
tablet: {
20+
breakpoint: { max: 1024, min: 464 },
21+
items: 4
22+
},
23+
mobile: {
24+
breakpoint: { max: 464, min: 0 },
25+
items: 2
26+
}
27+
};
28+
29+
const PartnersContainer = styled(MainContainer)`
30+
overflow-x: hidden;
31+
margin-top: 69px;
32+
33+
p {
34+
height: 70px;
35+
display: flex;
36+
align-items: flex-end;
37+
justify-content: center;
38+
}
39+
40+
@media (min-width: 900px) {
41+
.partners-container {
42+
margin-right: 18px;
43+
}
44+
}
45+
46+
@media (min-width: 1280px) {
47+
margin-top: 100px;
48+
padding-left: 0;
49+
50+
.section-heading {
51+
font-size: 70px;
52+
line-height: 67px;
53+
}
54+
}
55+
56+
@media (min-width: 1280px) {
57+
padding: 0 46px;
58+
}
59+
60+
@media (min-width: 1440px) {
61+
padding: 0 72px;
62+
.section-heading {
63+
font-size: 60px;
64+
line-height: 60px;
65+
}
66+
}
67+
`;
68+
69+
const StyledCarousel = styled(Carousel)`
70+
margin: 30px auto;
71+
ul {
72+
display: flex;
73+
align-items: center;
74+
}
75+
76+
li {
77+
margin: 0 4px;
78+
}
79+
80+
@media (min-width: 1280px) {
81+
margin: 54px auto;
82+
83+
li {
84+
margin: 0 30px;
85+
}
86+
}
87+
`;
88+
989
const OurPartners = ({ partners }) => {
1090
const scrollContainer = React.useRef(null);
1191

1292
useHorizontalAutoScroll(scrollContainer);
1393

1494
return (
15-
<MainContainer>
16-
<OurPartnersStyle>
17-
<div className={'content'}>
18-
<HeroText className={'section-heading'}>Our Partners</HeroText>
19-
</div>
20-
<ScrollContainer className="partners-container" vertical={false} innerRef={scrollContainer}>
21-
{partners.map((partner) => (
22-
<a key={partner.id} href={`https://${partner.name}`} target="_blank" rel="noreferrer noopener">
23-
<Image fixed={partner.childImageSharp.fixed} />
24-
</a>
25-
))}
26-
</ScrollContainer>
27-
</OurPartnersStyle>
28-
</MainContainer>
95+
<PartnersContainer>
96+
<HeroText className={'section-heading'}>Our Partners</HeroText>
97+
<StyledCarousel responsive={responsive} autoPlay infinite>
98+
{partners.map((partner) => (
99+
<a key={partner.id} href={`https://${partner.name}`} target="_blank" rel="noreferrer noopener">
100+
<Image fixed={partner.childImageSharp.fixed} />
101+
</a>
102+
))}
103+
</StyledCarousel>
104+
</PartnersContainer>
29105
);
30106
};
31107

src/styles/OurPartners.js

Lines changed: 0 additions & 53 deletions
This file was deleted.

src/templates/project.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ const ProjectTemplate = ({ data }) => {
326326
{newsletter && (
327327
<LeftText>
328328
<p>Subscribe to our newsletter:</p>
329-
<a class="btn-newsletter" href={newsletter}>
329+
<a className="btn-newsletter" href={newsletter}>
330330
Subscribe
331331
</a>
332332
</LeftText>
@@ -493,7 +493,7 @@ export const pageQuery = graphql`
493493
website
494494
logo {
495495
childImageSharp {
496-
fixed(width: 180) {
496+
fixed(width: 110) {
497497
...GatsbyImageSharpFixed_noBase64
498498
}
499499
}

0 commit comments

Comments
 (0)