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, {useEffect, useState} from 'react'; | |
| import {NextPage} from 'next'; | |
| import {useRouter} from 'next/router' | |
| import {ContentfulService} from '../core/contentful'; | |
| import {BlogPost} from '../interfaces/post'; | |
| import Layout from '../shared/components/layout'; | |
| import Card from '../shared/components/card'; |
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
| // next.config.js | |
| const withCSS = require('@zeit/next-css'); | |
| module.exports = withCSS({}); |
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 path = require('path'); | |
| const Dotenv = require('dotenv-webpack'); | |
| const next_config = { | |
| webpack: config => { | |
| config.plugins = config.plugins || []; | |
| config.plugins = [ | |
| ...config.plugins, | |
| // Read the .env file |
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 App from 'next/app'; | |
| import React from 'react'; | |
| import Router from 'next/router'; | |
| import {trackPageView} from '../core/gtag'; | |
| Router.events.on('routeChangeComplete', url => trackPageView(url)); | |
| class MyApp extends App { | |
| render() { |
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, { Fragment } from 'react'; | |
| import Document, { Head, Main, NextScript } from 'next/document'; | |
| import { GA_TRACKING_ID } from '../core/gtag'; | |
| type Props = { | |
| isProduction: boolean, | |
| } | |
| export default class extends Document<Props> { | |
| static async getInitialProps(ctx) { |
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
| // Add your GA tracking id here | |
| export const GA_TRACKING_ID = ''; | |
| const isProduction = process.env.NODE_ENV.toLowerCase() === 'production'; | |
| // https://developers.google.com/analytics/devguides/collection/gtagjs/pages | |
| export const trackPageView = url => { | |
| if (isProduction) { | |
| // @ts-ignore | |
| window.gtag('config', GA_TRACKING_ID, { |
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
| .paginator { | |
| display: flex; | |
| justify-content: center; | |
| align-content: center; | |
| } | |
| .paginator__page-number { | |
| padding: 0.5rem 1rem; | |
| margin: auto 0.5rem; |
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, {FunctionComponent, Fragment, useState, useEffect} from 'react'; | |
| import './styles.css'; | |
| type Props = { | |
| skip?: number; | |
| range: number[]; | |
| handlePaginationChange: Function; | |
| } | |
| const PaginatorComponent: FunctionComponent<Props> = ({skip, range, handlePaginationChange}) => { | |
| skip = !!skip ? skip : 0; |
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
| // next.config.js | |
| const withCSS = require('@zeit/next-css'); | |
| const path = require('path'); | |
| const Dotenv = require('dotenv-webpack'); | |
| const { generateAllArticles } = require('./utils/helpers'); | |
| const next_config = { | |
| webpack: config => { | |
| config.plugins = config.plugins || []; |
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
| .card { | |
| display: flex; | |
| flex-direction: column; | |
| background-color: #fff; | |
| border-radius: 4px; | |
| border: 1px solid #e5e5e5; | |
| overflow: hidden; |