Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

Commit

Permalink
feat: add ambassador schema on co-construction page
Browse files Browse the repository at this point in the history
  • Loading branch information
Alezco committed Sep 15, 2020
1 parent 79d96dc commit 8e3696a
Show file tree
Hide file tree
Showing 15 changed files with 284 additions and 122 deletions.
2 changes: 1 addition & 1 deletion src/components/mobile-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const MobileHeader: FC<MobileHaderProps> = ({
component={GatsbyLink}
to="/co-construction"
>
Co-créer Archifiltre
Co-créez Archifiltre
</MenuItem>
<MenuItem onClick={onToggleTheme}>
<span>Thème</span>
Expand Down
6 changes: 3 additions & 3 deletions src/components/presentation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ const useStyles = makeStyles((theme: Theme) => ({
icon: {
"&>svg": {
height: "auto",
width: theme.spacing(6),
width: theme.spacing(4.5),
},
},
root: {
image: {
width: "100%",
},
}));
Expand All @@ -50,7 +50,7 @@ const Presentation: FC = () => {
))}
</Grid>
</Grid>
<Grid item md={6} className={classes.root}>
<Grid item md={6} className={classes.image}>
<Link to="/produit" component={GatsbyLink}>
<Img
fluid={data.file.childImageSharp.fluid}
Expand Down
28 changes: 28 additions & 0 deletions src/components/theme-image.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import Img, { FluidObject } from "gatsby-image";
import React, { FC } from "react";

import { ThemeContext } from "../layout";

type ThemeImageProps = {
lightThemeImage: FluidObject;
darkThemeImage: FluidObject;
alt: string;
};

const ThemeImage: FC<ThemeImageProps> = ({
lightThemeImage,
darkThemeImage,
alt,
}) => (
<ThemeContext.Consumer>
{(theme) =>
theme === "light" ? (
<Img fluid={lightThemeImage} alt={alt} />
) : (
<Img fluid={darkThemeImage} alt={alt} />
)
}
</ThemeContext.Consumer>
);

export default ThemeImage;
1 change: 1 addition & 0 deletions src/display-data/faq-data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ export const faqData = [
href="mailto:archifiltre@sg.social.gouv.fr"
target="_blank"
color="primary"
rel="noopener"
>
mail
</Link>
Expand Down
2 changes: 1 addition & 1 deletion src/layout/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const Header: FC<HeaderProps> = ({ onToggleTheme, theme }) => {
<Button
disableElevation
color="primary"
variant="outlined"
variant="contained"
component={GatsbyLink}
to="/co-construction"
>
Expand Down
20 changes: 12 additions & 8 deletions src/layout/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Container, CssBaseline, Theme } from "@material-ui/core";
import useMediaQuery from "@material-ui/core/useMediaQuery";
import { makeStyles, ThemeProvider } from "@material-ui/styles";
import React, { FC } from "react";
import React, { createContext, FC } from "react";

import CookieConsent from "../components/cookie-consent";
import useLocalStorage from "../hooks/useLocalStorage";
Expand All @@ -20,6 +20,8 @@ const useStyles = makeStyles((theme: Theme) => ({
},
}));

export const ThemeContext = createContext<ThemeMode>("light");

type ThemeMode = "light" | "dark";

const Layout: FC<{ container?: boolean }> = ({
Expand All @@ -41,13 +43,15 @@ const Layout: FC<{ container?: boolean }> = ({
<CookieConsent />
<div className={classes.root}>
<Header onToggleTheme={toggleTheme} theme={theme} />
{container ? (
<Container component="main" maxWidth="md" className={classes.main}>
{children}
</Container>
) : (
<main className={classes.main}>{children}</main>
)}
<ThemeContext.Provider value={theme}>
{container ? (
<Container component="main" maxWidth="md" className={classes.main}>
{children}
</Container>
) : (
<main className={classes.main}>{children}</main>
)}
</ThemeContext.Provider>
<Footer />
</div>
</ThemeProvider>
Expand Down
83 changes: 0 additions & 83 deletions src/pages/co-construction.mdx

This file was deleted.

Loading

0 comments on commit 8e3696a

Please sign in to comment.