- implement celebi template

This commit is contained in:
Amruth Pillai
2020-07-13 09:46:55 +05:30
parent 7b2094a543
commit 55fd1d4bdc
31 changed files with 3563 additions and 99 deletions

View File

@ -1,4 +1,6 @@
import cx from 'classnames';
import { graphql, useStaticQuery } from 'gatsby';
import GatsbyImage from 'gatsby-image';
import React, { memo } from 'react';
import { useDispatch, useSelector } from '../../../../contexts/ResumeContext';
import templateOptions from '../../../../data/templateOptions';
@ -10,6 +12,53 @@ const Templates = () => {
const dispatch = useDispatch();
const template = useSelector('metadata.template');
const previews = useStaticQuery(graphql`
query {
onyx: file(relativePath: { eq: "templates/onyx.png" }) {
childImageSharp {
fluid(maxHeight: 400) {
...GatsbyImageSharpFluid
}
}
}
pikachu: file(relativePath: { eq: "templates/pikachu.png" }) {
childImageSharp {
fluid(maxHeight: 400) {
...GatsbyImageSharpFluid
}
}
}
gengar: file(relativePath: { eq: "templates/gengar.png" }) {
childImageSharp {
fluid(maxHeight: 400) {
...GatsbyImageSharpFluid
}
}
}
castform: file(relativePath: { eq: "templates/castform.png" }) {
childImageSharp {
fluid(maxHeight: 400) {
...GatsbyImageSharpFluid
}
}
}
glalie: file(relativePath: { eq: "templates/glalie.png" }) {
childImageSharp {
fluid(maxHeight: 400) {
...GatsbyImageSharpFluid
}
}
}
celebi: file(relativePath: { eq: "templates/celebi.png" }) {
childImageSharp {
fluid(maxHeight: 400) {
...GatsbyImageSharpFluid
}
}
}
}
`);
const handleClick = (value) => {
dispatch({
type: 'on_input',
@ -36,7 +85,13 @@ const Templates = () => {
[styles.selected]: template === x.id,
})}
>
<img loading="lazy" height="240px" src={x.preview} alt={x.name} />
<GatsbyImage
alt={x.name}
loading="eager"
className="w-full"
style={{ height: '225px' }}
fluid={previews[x.id].childImageSharp.fluid}
/>
<span>{x.name}</span>
</div>
))}