Skip to content

Instantly share code, notes, and snippets.

Avatar
😼
wanna something?

Wojciech Bożek tobob

😼
wanna something?
View GitHub Profile
View blog-post.js
import React from 'react'
import { graphql } from 'gatsby'
import { Helmet } from 'react-helmet'
import React from "react";
import { graphql } from "gatsby";
import { Helmet } from "react-helmet";
import get from "lodash/get";
import Img from "gatsby-image";
import Layout from "../components/layout";
import QuoteComponent, {
View quote-component.js
import React from "react";
import { graphql } from "gatsby";
const QuoteComponent = ({ quote, author, theme }) => (
<div
style={{
backgroundColor: theme,
padding: "30px",
width: "80%",
margin: "0 0 auto",
View wall-of-text-component.js
import React from "react"
import { graphql } from "gatsby"
import RichText from '@madebyconnor/rich-text-to-jsx';
const WallOfTextComponent = ({text}) => <RichText richText={text.json} />
export default WallOfTextComponent
export const modelName = 'ContentfulWallOfTextComponent';
View code-component_v2.js
import React from "react";
import { graphql } from "gatsby";
import Gist from "super-react-gist";
const CodeComponent = ({ url }) => <Gist url={url} />;
export default CodeComponent;
export const modelName = "ContentfulCodeComponent";
View contentImplementation.js
const content = () => {
if(post.contentReferences) {
return(post.contentReferences.map(reference => {
switch(reference.__typename) {
case 'ContentfulCodeComponent': {
return <CodeComponent {...reference} />
}
default:
return null
}
View 3rdPostQuery.js
export const pageQuery = graphql`
query BlogPostBySlug($slug: String!) {
contentfulBlogPost(slug: { eq: $slug }) {
title
publishDate(formatString: "MMMM Do, YYYY")
heroImage {
fluid(maxWidth: 1180, background: "rgb:000000") {
...GatsbyContentfulFluid_tracedSVG
}
}
@tobob
tobob / 3rdPageQuery.js
Last active Dec 30, 2020
3rdPageQuery.js
View 3rdPageQuery.js
export const pageQuery = graphql`
query BlogPostBySlug($slug: String!) {
contentfulBlogPost(slug: { eq: $slug }) {
title
publishDate(formatString: "MMMM Do, YYYY")
heroImage {
fluid(maxWidth: 1180, background: "rgb:000000") {
...GatsbyContentfulFluid_tracedSVG
}
}
View code-component.js
import React from "react"
import { graphql } from "gatsby"
const CodeComponent = () => <div><span></span></div>
export default CodeComponent
export const query = graphql`
fragment CodeComponentFragment on ContentfulCodeComponent {
url
View 2ndPostQuery.js
query BlogPostBySlug($slug: String!) {
contentfulBlogPost(slug: { eq: $slug }) {
contentReferences {
... on ContentfulCodeComponent {
url
__typename
}
}
}
}
View defaultPageQuery.js
export const pageQuery = graphql`
query BlogPostBySlug($slug: String!) {
contentfulBlogPost(slug: { eq: $slug }) {
title
publishDate(formatString: "MMMM Do, YYYY")
heroImage {
fluid(maxWidth: 1180, background: "rgb:000000") {
...GatsbyContentfulFluid_tracedSVG
}
}