This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Layout component that queries for data | |
* with Gatsby's StaticQuery component | |
*/ | |
import React from "react" | |
import PropTypes from "prop-types" | |
import { StaticQuery, graphql } from "gatsby" | |
import Header from "./header" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
import { StaticQuery, graphql } from "gatsby" | |
import Img from "gatsby-image" | |
/* | |
* This component is built using `gatsby-image` to automatically serve optimized | |
* images with lazy loading and reduced file sizes. The image is loaded using a | |
* `StaticQuery`, which allows us to load the image from directly within this | |
* component, rather than having to pass the image data down from pages. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import './components/error/error' | |
import content404 from './components/404/404.html' | |
import DATA_SERVICE from './utils/data' | |
const ds = new DATA_SERVICE() | |
// get SPA containing element | |
const $el = document.getElementById('app') | |
// define routes | |
const home = async () => { | |
await import('./components/recipe/recipe') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import template from './recipe.html' | |
import DATA_SERVICE from '../../utils/data' | |
export default class Recipe extends HTMLElement { | |
constructor () { | |
// attach shadow DOM, initialize private recipe property, and initialize data service | |
super() | |
this._shadowRoot = this.attachShadow({ mode: 'open' }) | |
this._recipe = null | |
this.ds = new DATA_SERVICE() | |
} |