diff --git a/frontend/component/Gallery/Gallery.js b/frontend/component/Gallery/Gallery.js index 04552a5..4ce1bfb 100644 --- a/frontend/component/Gallery/Gallery.js +++ b/frontend/component/Gallery/Gallery.js @@ -1,7 +1,5 @@ import React, { Component } from 'react'; import Paper from 'material-ui/Paper'; -import GridList from '@material-ui/core/GridList'; -import GridListTile from '@material-ui/core/GridListTile'; import Ribbon from '../Ribbon'; import tileData from './mock'; import LazyImg from '../utils/lazyImg/LazyImg'; diff --git a/frontend/component/utils/lazyImg/LazyImg.js b/frontend/component/utils/lazyImg/LazyImg.js index 9c38009..13eb58d 100644 --- a/frontend/component/utils/lazyImg/LazyImg.js +++ b/frontend/component/utils/lazyImg/LazyImg.js @@ -1,8 +1,15 @@ import React, { Component } from 'react'; import styles from './lazyImg.css'; +require('intersection-observer'); + const IMG_S = '?imageView2/2/w/30/h/20/interlace/0/q/100'; +if (!('MutationObserver' in window)) { + IntersectionObserver.prototype.POLL_INTERVAL = + IntersectionObserver.prototype.THROTTLE_TIMEOUT || 100; +} + class LazyImg extends Component { constructor(props) { super(props); diff --git a/frontend/config/webpack.config.dev.js b/frontend/config/webpack.config.dev.js index ec4ca72..9a59fb1 100644 --- a/frontend/config/webpack.config.dev.js +++ b/frontend/config/webpack.config.dev.js @@ -1,5 +1,3 @@ -'use strict'; - const autoprefixer = require('autoprefixer'); const path = require('path'); const webpack = require('webpack'); @@ -47,7 +45,7 @@ module.exports = { // require.resolve('webpack/hot/dev-server'), require.resolve('react-dev-utils/webpackHotDevClient'), // Finally, this is your app's code: - paths.appIndexJs, + paths.appIndexJs // We include the app code last so that if there is a runtime error during // initialization, it doesn't blow up the WebpackDevServer client, and // changing JS code would still trigger a refresh. @@ -62,10 +60,10 @@ module.exports = { // There are also additional JS chunk files if you use code splitting. chunkFilename: 'static/js/[name].chunk.js', // This is the URL that app is served from. We use "/" in development. - publicPath: publicPath, + publicPath, // Point sourcemap entries to original disk location (format as URL on Windows) devtoolModuleFilenameTemplate: info => - path.resolve(info.absoluteResourcePath).replace(/\\/g, '/'), + path.resolve(info.absoluteResourcePath).replace(/\\/g, '/') }, resolve: { // This allows you to set a fallback for where Webpack should look for modules. @@ -84,10 +82,9 @@ module.exports = { // for React Native Web. extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx'], alias: { - // Support React Native Web // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/ - 'react-native': 'react-native-web', + 'react-native': 'react-native-web' }, plugins: [ // Prevents users from importing files from outside of src/ (or node_modules/). @@ -95,8 +92,8 @@ module.exports = { // To fix this, we prevent you from importing files out of src/ -- if you'd like to, // please link the files into your node_modules/ and let module-resolution kick in. // Make sure your source files are compiled, as they will not be processed in any way. - new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]), - ], + new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]) + ] }, module: { strictExportPresence: true, @@ -114,13 +111,12 @@ module.exports = { { options: { formatter: eslintFormatter, - eslintPath: require.resolve('eslint'), - + eslintPath: require.resolve('eslint') }, - loader: require.resolve('eslint-loader'), - }, + loader: require.resolve('eslint-loader') + } ], - include: paths.appSrc, + include: paths.appSrc }, { // "oneOf" will traverse all following loaders until one will @@ -135,8 +131,8 @@ module.exports = { loader: require.resolve('url-loader'), options: { limit: 10000, - name: 'static/media/[name].[hash:8].[ext]', - }, + name: 'static/media/[name].[hash:8].[ext]' + } }, // Process JS with Babel. { @@ -144,12 +140,11 @@ module.exports = { include: paths.appSrc, loader: require.resolve('babel-loader'), options: { - // This is a feature of `babel-loader` for webpack (not Babel itself). // It enables caching results in ./node_modules/.cache/babel-loader/ // directory for faster rebuilds. - cacheDirectory: true, - }, + cacheDirectory: true + } }, // "postcss" loader applies autoprefixer to our CSS. // "css" loader resolves paths in CSS and adds assets as dependencies. @@ -166,8 +161,8 @@ module.exports = { importLoaders: 1, modules: true, sourceMaps: true, - localIdentName: '[name]__[local]___[hash:base64:5]', - }, + localIdentName: '[name]__[local]___[hash:base64:5]' + } }, { loader: require.resolve('postcss-loader'), @@ -182,14 +177,14 @@ module.exports = { '>1%', 'last 4 versions', 'Firefox ESR', - 'not ie < 9', // React doesn't support IE8 anyway + 'not ie < 9' // React doesn't support IE8 anyway ], - flexbox: 'no-2009', - }), - ], - }, - }, - ], + flexbox: 'no-2009' + }) + ] + } + } + ] }, // "file" loader makes sure those assets get served by WebpackDevServer. // When you `import` an asset, you get its (virtual) filename. @@ -204,14 +199,14 @@ module.exports = { exclude: [/\.(js|jsx|mjs)$/, /\.html$/, /\.json$/], loader: require.resolve('file-loader'), options: { - name: 'static/media/[name].[hash:8].[ext]', - }, - }, - ], - }, + name: 'static/media/[name].[hash:8].[ext]' + } + } + ] + } // ** STOP ** Are you adding a new loader? // Make sure to add the new loader(s) before the "file" loader. - ], + ] }, plugins: [ // Makes some environment variables available in index.html. @@ -222,7 +217,7 @@ module.exports = { // Generates an `index.html` file with the