This file contains hidden or 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
| exports.createPages = async ({ graphql, actions, reporter }) => { | |
| const { createPage } = actions | |
| const blogPost = path.resolve(`./src/templates/blog-post.js`) | |
| const defaultPage = path.resolve(`./src/templates/page.js`) | |
| const blogPage = path.resolve(`./src/templates/blog-list.js`) | |
| const tabPage = path.resolve(`./src/templates/tag.js`) | |
| const categoryPage = path.resolve(`./src/templates/category.js`) | |
| const result = await graphql( |
This file contains hidden or 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
| plugins: [ | |
| { | |
| resolve: `gatsby-source-filesystem`, | |
| options: { | |
| path: `${__dirname}/content/blog`, | |
| name: `blog`, | |
| }, | |
| }, | |
| { | |
| resolve: `gatsby-source-filesystem`, |
This file contains hidden or 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
| query BlogPostBySlug($slug: String!) { | |
| mdx(fields: { slug: { eq: $slug } }) { | |
| id | |
| excerpt(pruneLength: 160) | |
| body | |
| } | |
| } |
This file contains hidden or 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
| plugins: [ | |
| `gatsby-plugin-sass`, | |
| { | |
| resolve: "gatsby-plugin-sitemap", | |
| options: { | |
| exclude: [`/blog/page:*`, `/blog/tag:*`, `/blog/category:*`], | |
| }, | |
| }, | |
| ], |
This file contains hidden or 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
| mport React, { Component } from "react" | |
| import { getAllCountriesInfo } from "../api/covid" | |
| import Layout from "../components/Layout/Layout" | |
| import SEO from "../components/Seo/Seo" | |
| import InfoMap from "../components/InfoMap/InfoMap" | |
| import Table from "../components/Table/Table" | |
| class IndexPage extends Component { |
This file contains hidden or 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
| return ( | |
| <Map {...mapSettings}> | |
| <TileLayer | |
| url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" | |
| attribution='© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' | |
| /> | |
| <MarkerList /> | |
| </Map> | |
| ) |
This file contains hidden or 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
| class InfoMap extends Component { | |
| render() { | |
| const mapSettings = { | |
| center: CENTER, | |
| defaultBaseMap: "OpenStreetMap", | |
| zoom: DEFAULT_ZOOM, | |
| } | |
| const MarkerList = () => { | |
| const { countries } = this.props |
This file contains hidden or 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, { Component } from "react" | |
| import L from "leaflet" | |
| import { Map, Marker, Popup, TileLayer } from "react-leaflet" | |
| const LOCATION = { | |
| lat: 40.416775, | |
| lng: -3.70379, | |
| } | |
| const CENTER = [LOCATION.lat, LOCATION.lng] |
This file contains hidden or 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
| [ | |
| { | |
| "country": "USA", | |
| "countryInfo": { | |
| "_id": 840, | |
| "country": "USA", | |
| "iso2": "US", | |
| "iso3": "USA", | |
| "lat": 38, | |
| "long": -97, |
This file contains hidden or 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
| const axios = require("axios") | |
| const get = endpoint => axios.get(`https://corona.lmao.ninja${endpoint}`) | |
| export async function getAllCountriesInfo() { | |
| try { | |
| let res = await get("/countries?sort=cases") | |
| return res.data | |
| } catch (error) { | |
| console.log(error) |