├── CONTRIBUTING.md
├── .storybook
├── addons.js
├── config.js
└── webpack.config.js
├── src
├── index.tsx
├── fallbackUtils.tsx
├── LazyImage.tsx
└── LazyImageFull.tsx
├── .prettier
├── tsconfig.json
├── stories
├── demo
│ └── img
│ │ ├── porto_buildings_large.jpg
│ │ └── porto_buildings_lowres.jpg
├── utils.tsx
├── styles.css
├── LazyImageFull.story.tsx
├── OpinionatedComponents.tsx
└── LazyImage.story.tsx
├── .gitignore
├── changes.md
├── .eslintrc
├── tsconfig_base.json
├── ROADMAP.md
├── FEEDBACK.md
├── LICENSE.md
├── package.json
└── README.md
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.storybook/addons.js:
--------------------------------------------------------------------------------
1 | import '@storybook/addon-options/register'
2 | import '@storybook/addon-actions/register'
3 |
--------------------------------------------------------------------------------
/src/index.tsx:
--------------------------------------------------------------------------------
1 | export * from "./LazyImage";
2 | export * from "./LazyImageFull";
3 | // export * from './fallbackUtils';
4 |
--------------------------------------------------------------------------------
/.prettier:
--------------------------------------------------------------------------------
1 | {
2 | "printWidth": 80,
3 | "bracketSpacing": false,
4 | "singleQuote": true,
5 | "trailingComma": "es5"
6 | }
7 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig_base.json",
3 | "compilerOptions": {
4 | "declaration": false
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/stories/demo/img/porto_buildings_large.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fpapado/react-lazy-images/HEAD/stories/demo/img/porto_buildings_large.jpg
--------------------------------------------------------------------------------
/stories/demo/img/porto_buildings_lowres.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fpapado/react-lazy-images/HEAD/stories/demo/img/porto_buildings_lowres.jpg
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | microbundle/
3 | ts-build/
4 | node_modules/
5 | dist/
6 | ts-build/
7 | public/
8 | cached/
9 | app/
10 | npm-debug.log*
11 | .env
12 | .envrc
13 | .env.*
14 | *.swp
15 | .vscode/
16 | *.log
17 | .rpt2_cache/
18 | .out/
19 |
--------------------------------------------------------------------------------
/changes.md:
--------------------------------------------------------------------------------
1 | - "Buffering" state is exposed in LazyImageFull, but not in LazyImage. Does it make sense to even expose?
2 | - Not exposing it would be non-breaking!
3 | - Add "debounceDuration" or prop; decide on naming!
4 | - Make optional, and 0 by default.
5 |
--------------------------------------------------------------------------------
/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "parser": "@typescript-eslint/parser",
3 | "plugins": [
4 | "jsx-a11y"
5 | ],
6 | "extends": [
7 | "plugin:jsx-a11y/recommended"
8 | ],
9 | "parserOptions": {
10 | "ecmaVersion": 6,
11 | "sourceType": "module",
12 | "ecmaFeatures": {
13 | "jsx": true
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/tsconfig_base.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "es2015",
4 | "target": "es5",
5 | "declaration": true,
6 | "sourceMap": true,
7 | "jsx": "react",
8 | "allowJs": false,
9 | "strict": true,
10 | "rootDirs": ["src", "stories"],
11 | "outDir": "ts-build",
12 | "moduleResolution": "node",
13 | "allowSyntheticDefaultImports": true,
14 | "esModuleInterop": true,
15 | "lib": ["es6", "dom"],
16 | "baseUrl": "./"
17 | },
18 | "include": ["src/**/*"],
19 | "exclude": ["node_modules", "dist"]
20 | }
21 |
--------------------------------------------------------------------------------
/.storybook/config.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import {configure} from '@storybook/react';
3 | import {setOptions} from '@storybook/addon-options';
4 | import { setDefaults } from '@storybook/addon-info';
5 |
6 | import 'tachyons';
7 |
8 | // addon-info
9 | setDefaults({
10 | header: false, // Toggles display of header with component name and description
11 | inline: true,
12 | });
13 |
14 | setOptions({
15 | name: 'React Lazy Images',
16 | url: 'https://github.com/fpapado/react-lazy-images',
17 | addonPanelInRight: true
18 | });
19 |
20 | const req = require.context('../stories', true, /story\.tsx?$/)
21 |
22 | function loadStories() {
23 | req.keys().forEach(req)
24 | }
25 |
26 | configure(loadStories, module)
27 |
--------------------------------------------------------------------------------
/.storybook/webpack.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | // const TSDocgenPlugin = require('react-docgen-typescript-webpack-plugin');
3 |
4 | module.exports = (baseConfig, env, config) => {
5 | config.module.rules.push({
6 | test: /\.tsx?$/,
7 | include: [
8 | path.resolve(__dirname, '../src/'),
9 | path.resolve(__dirname, '../stories/')
10 | ],
11 | use: [
12 | require.resolve('awesome-typescript-loader'),
13 | require.resolve('react-docgen-typescript-loader')
14 | ],
15 | exclude: [
16 | path.resolve(__dirname, 'node_modules/'),
17 | ]
18 | });
19 | // config.plugins.push(new TSDocgenPlugin());
20 | config.resolve.extensions.push('.ts', '.tsx');
21 | return config;
22 | };
23 |
--------------------------------------------------------------------------------
/stories/utils.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | export const Container: React.SFC<{}> = ({ children }) => (
4 |
5 |
9 |
10 | Scroll down to see the photos :)
11 | You might want to throttle the network in your dev tools to see the
12 | effect.
13 |
14 |
15 |
{children}
16 |
17 | );
18 |
19 | export const Divider: React.SFC<{}> = ({ children }) => (
20 | {children}
21 | );
22 |
--------------------------------------------------------------------------------
/ROADMAP.md:
--------------------------------------------------------------------------------
1 | # Always
2 |
3 | - Docs improvements! See [`FEEDBACK.md`](./FEEDBACK.md) for specific points.
4 | - Loading patterns and auxiliary component examples
5 |
6 | # v1
7 |
8 | - [x] Upgrade devDeps
9 | - [x] Upgrade microbundle
10 | - [x] Check --external all consequence
11 | - [x] Upgrade react-intersection-observer
12 | - [x] Pass Ref
13 | - [x] Prop collection
14 | - [x] Split out renderXYZ components
15 | - [x] Refactor props
16 | - [x] Elicit feedback and use cases for the public API
17 | - [~] Investigate container ``
18 | - [ ] Solidify `