Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insertion d'un hero component sur la page d'index #106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/components/Button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import { Link } from 'gatsby';

const StyledLink = styled(props => <Link {...props} />)`
padding: 16px;
border-radius: 4px;
border: 1px solid ${({ theme }) => theme.green};
color: ${({ theme }) => theme.green};
font-size: 1.1rem;
transition: 0.3s all ease;
&:hover {
color: ${({ theme }) => theme.blue};
border-color: ${({ theme }) => theme.blue};
}
`;

const Button = ({ to, children }) => (
<StyledLink to={to}>{children}</StyledLink>
);

Button.propTypes = {
to: PropTypes.string.isRequired,
};

export default Button;
115 changes: 115 additions & 0 deletions src/components/Hero.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import React from 'react';
import styled from 'styled-components';
import HeroBackground from '../../static/heroBackground.jpeg';

const Wrapper = styled.div`
width: 100%;
height: 500px;
background-image: url(${HeroBackground});
background-size: cover;
background-position: 100% 60%;
@media (max-width: ${props => props.theme.mobileSize}) {
height: auto;
}
`;

const GhostWrapper = styled.div`
height: 100%;
width: 100%;
background-color: #00000070;

h1 {
text-align: center;
font-size: 3rem;
color: white;
}

@media (max-width: ${props => props.theme.mobileSize}) {
h1 {
font-size: 2.5rem;
}
}
`;

const Content = styled.div`
display: flex;
height: 100%;
justify-content: center;
@media (max-width: ${props => props.theme.mobileSize}) {
flex-wrap: wrap;
}
`;

const TitleContent = styled.div`
height: 100%;
display: flex;
justify-content: start;
flex-direction: column;
padding: 40px;

p {
font-size: 2rem;
color: white;
}

@media (max-width: ${props => props.theme.mobileSize}) {
p {
font-size: 1.5rem;
}
}
`;

const DiagonalDivider = styled.div`
width: 0;
left: 0;
border-right: 100px solid white;
border-top: 500px solid transparent;
@media (max-width: ${props => props.theme.mobileSize}) {
display: none;
}
`;

const UpcomingEventWrapper = styled.div`
width: 60%;
min-width: 320px;
height: 100%;
background-color: white;
color: black;
padding: 3rem;
padding-top: 5rem;
margin: auto;
text-align: center;

h2 {
font-size: 2rem;
}

a {
display: inline-block;
margin-top: 3rem;
}
@media (max-width: ${props => props.theme.mobileSize}) {
width: 100%;
padding-top: 0;

}
`;

export default ({ children }) => (
<Wrapper>
<GhostWrapper>
<Content>
<TitleContent>
<h1>Les Caen camps</h1>
<p>Communauté Caennaise de développeur-euses.</p>
<p>
Conférence chaque dernier mardi du mois accessible à
toutes et à tous.
</p>
</TitleContent>
<DiagonalDivider />
<UpcomingEventWrapper>{children}</UpcomingEventWrapper>
</Content>
</GhostWrapper>
</Wrapper>
);
8 changes: 4 additions & 4 deletions src/components/Logo.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ export default styled.img.attrs({
})`
display: block;
position: absolute;
left: 1rem;
top: 1rem;
left: 0.6rem;
top: 0.6rem;
bottom: 0;
height: 4rem;
height: 3rem;
@media (max-width: ${props => props.theme.mobileSize}) {
height: 2rem;
height: 1.2rem;
display: none;
}
`;
4 changes: 2 additions & 2 deletions src/components/Nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import Link from 'gatsby-link';
const Nav = styled.nav`
margin: auto;
a {
font-size: 1.4rem;
font-size: 1.3rem;
display: inline-block;
color: ${({ theme }) => theme.grey};
padding: 2.1rem 0;
padding: 1.2rem 0;
font-variant: small-caps;
margin-right: 1rem;
margin-left: 1rem;
Expand Down
99 changes: 99 additions & 0 deletions src/components/layouts/fullPageLayout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { StaticQuery, graphql } from 'gatsby';
import styled, { ThemeProvider } from 'styled-components';
import { Helmet } from 'react-helmet';

import favicon from '../../../static/favicon/favicon-16x16.png';
import FooterContent from '../../components/Footer';
import HeaderContent from '../../components/Header';
import theme, { GlobalStyle } from '../../utils/theme';

const Container = styled.div`
height: 100%;
width: 100%;
margin-top: 33px;
`;

export const MaxWidthContent = styled.div`
max-width: 900px;
margin: auto;
`;

const Header = styled.header`
`;

const Content = styled.section`
`;
const Footer = styled.footer`
`;

class TemplateWrapper extends Component {
render() {
const { children } = this.props;

return (
<StaticQuery
query={graphql`
query HomeQuery {
site {
siteMetadata {
title
baseline
socialLinks {
title
url
}
}
}
nextMeetup: allMeetupEvent(
limit: 1
filter: { status: { eq: "upcoming" } }
) {
edges {
node {
name
link
yes_rsvp_count
}
}
}
}
`}
render={data => (
<ThemeProvider theme={theme}>
<>
<GlobalStyle />
<Container>
<Helmet>
<link
rel="icon"
href={favicon}
type="image/x-icon"
/>
</Helmet>
<Header>
<HeaderContent />
</Header>
<Content>{children}</Content>
<Footer>
<FooterContent
socialLinks={
data.site.siteMetadata.socialLinks
}
/>
</Footer>
</Container>
</>
</ThemeProvider>
)}
/>
);
}
}

TemplateWrapper.propTypes = {
children: PropTypes.object,
};

export default TemplateWrapper;
105 changes: 60 additions & 45 deletions src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ import {
} from '../utils/formatters';
import TalkListItem from '../components/talks/listItem';
import { CampListItem } from '../components/cccs/listItem';
import Hero from '../components/Hero';
import DevopsListItem from '../components/ccds/listItem';
import CaenCamp from '../components/CaenCamp';
import Layout from '../components/layout';
import Layout, { MaxWidthContent } from '../components/layouts/fullPageLayout';
import Button from '../components/Button';

const TalksContainer = styled.div`
display: flex;
Expand Down Expand Up @@ -75,50 +77,63 @@ export default ({ data }) => {
</Helmet>
<Content id="homeContent">
<SingleColumn>
<CaenCamp
cccs={data.cccs.edges.length}
dojos={data.dojos.edges.length}
lightnings={data.lightnings.edges.length}
partners="3"
speakers={data.speakers.edges.length}
talks={talks[0].edition}
/>
{nextTalk && (
<TalksContainer>
<h2>Prochain talk</h2>
<TalkListItem talk={nextTalk} />
</TalksContainer>
)}
{nextDevops && (
<TalksContainer>
<h2>Prochain CaenCamp Devops</h2>
<DevopsListItem edition={nextDevops} />
</TalksContainer>
)}
{nextCamp && (
<TalksContainer>
<h2>Prochain coding caen camp</h2>
<CampListItem camp={nextCamp} />
</TalksContainer>
)}
{lastTalk && (
<TalksContainer>
<h2>Dernier talk</h2>
<TalkListItem talk={lastTalk} />
</TalksContainer>
)}
{lastDevops && (
<TalksContainer>
<h2>Dernier CaenCamp Devops</h2>
<DevopsListItem edition={lastDevops} />
</TalksContainer>
)}
{lastCamp && (
<TalksContainer>
<h2>Dernier coding caen camp</h2>
<CampListItem camp={lastCamp} />
</TalksContainer>
)}
<Hero>
{nextTalk && (
<TalksContainer>
<h2>Prochain talk</h2>
<TalkListItem talk={nextTalk} />
</TalksContainer>
)}
{nextDevops && (
<TalksContainer>
<h2>Prochain CaenCamp Devops</h2>
<DevopsListItem edition={nextDevops} />
</TalksContainer>
)}
{nextCamp && (
<TalksContainer>
<h2>Prochain coding caen camp</h2>
<CampListItem camp={nextCamp} />
</TalksContainer>
)}

{!nextCamp && !nextTalk && !nextDevops && (
<>
<h2>Toi aussi deviens speaker !</h2>
<Button to="/call-for-speakers">
Proposer un sujet de talk
</Button>
</>
)}
</Hero>
<MaxWidthContent>
<CaenCamp
cccs={data.cccs.edges.length}
dojos={data.dojos.edges.length}
lightnings={data.lightnings.edges.length}
partners="3"
speakers={data.speakers.edges.length}
talks={talks[0].edition}
/>
{lastTalk && (
<TalksContainer>
<h2>Dernier talk</h2>
<TalkListItem talk={lastTalk} />
</TalksContainer>
)}
{lastDevops && (
<TalksContainer>
<h2>Dernier CaenCamp Devops</h2>
<DevopsListItem edition={lastDevops} />
</TalksContainer>
)}
{lastCamp && (
<TalksContainer>
<h2>Dernier coding caen camp</h2>
<CampListItem camp={lastCamp} />
</TalksContainer>
)}
</MaxWidthContent>
</SingleColumn>
</Content>
</div>
Expand Down
Loading