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 from 'react'; | |
| import PropTypes from 'prop-types'; | |
| import ProgressiveImage from 'react-progressive-image'; | |
| const Image = ({ | |
| src, alt, placeholderStyle, ...props | |
| }) => ( | |
| <ProgressiveImage src={src} placeholder=""> | |
| {(currentSrc, loading) => (loading ? ( | |
| <div style={{ background: '#040203', ...placeholderStyle }} {...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 from 'react'; | |
| class OfflineSupport extends React.PureComponent { | |
| componentDidMount() { | |
| if ('serviceWorker' in navigator) { | |
| navigator.serviceWorker | |
| .register('/sw.js') | |
| .then(() => console.log('service worker registered.')) | |
| .catch(err => console.dir(err)); | |
| } | |
| } |
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 from 'react'; | |
| import App, { Container } from 'next/app'; | |
| import OfflineSupport from '../components/OfflineSupport'; | |
| class CustomApp extends App { | |
| render() { | |
| const { Component, pageProps } = this.props; | |
| return ( | |
| <Container> | |
| <OfflineSupport /> | |
| <Component {...pageProps} /> |
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
| if (typeof require !== 'undefined') { | |
| require.extensions['.css'] = () => null; | |
| } | |
| const NextWorkboxPlugin = require('next-workbox-webpack-plugin'); | |
| const withCSS = require('@zeit/next-css'); | |
| const WebpackPwaManifest = require('webpack-pwa-manifest'); | |
| const path = require('path'); | |
| module.exports = withCSS({ | |
| webpack(config, { isServer, buildId, dev }) { | |
| config.node = { |
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 express = require('express'); | |
| const next = require('next'); | |
| const port = parseInt(process.env.PORT, 10) || 3000; | |
| const dev = process.env.NODE_ENV !== 'production'; | |
| const app = next({ dev }); | |
| const handle = app.getRequestHandler(); | |
| const Cache = require('lru-cache'); | |
| const ssrCache = new Cache({ | |
| max: 20, // not more than 20 results will be cached |
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 Head from 'next/head'; | |
| import React from 'react'; | |
| import { css } from '@emotion/core'; | |
| import { | |
| node, string, oneOfType, object | |
| } from 'prop-types'; | |
| import { ReactiveBase } from '@appbaseio/reactivesearch'; | |
| import mixpanel from 'mixpanel-browser'; | |
| import { MixpanelProvider } from 'react-mixpanel'; | |
| import { Layout } from 'antd'; |
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 from 'react'; | |
| import { connect } from 'react-redux'; | |
| import { Button } from 'antd'; | |
| import { | |
| object, func, string, oneOfType, number, array, | |
| } from 'prop-types'; | |
| import { | |
| Content, Footer, Header, Container, | |
| } from '../components/Layout'; | |
| import Page from '../components/Page'; |
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 some from 'lodash/some'; | |
| import AppConstants from '../utils/constants'; | |
| const initialProductState = { | |
| items: [], | |
| totalPrice: 0, | |
| }; | |
| const addItems = (items = [], payload) => { | |
| const newItems = items.map(item => item); |
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 from 'react'; | |
| import { Card, Button } from 'antd'; | |
| import { connect } from 'react-redux'; | |
| import get from 'lodash/get'; | |
| import { array, number, func } from 'prop-types'; | |
| import { | |
| Content, Footer, Header, Container, | |
| } from '../components/Layout'; | |
| import Page from '../components/Page'; | |
| import { removeToCart } from '../modules/actions'; |