react-image-gallery 1.2.11 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/webpack.config.js CHANGED
@@ -1,25 +1,28 @@
1
-
2
- const path = require('path');
3
- const MiniCssExtractPlugin = require('mini-css-extract-plugin');
1
+ const path = require("path");
2
+ const MiniCssExtractPlugin = require("mini-css-extract-plugin");
4
3
 
5
4
  module.exports = {
6
- entry: ['./example/app.js', './example/app.css', './styles/scss/image-gallery.scss'],
5
+ entry: [
6
+ "./example/App.jsx",
7
+ "./example/App.css",
8
+ "./styles/scss/image-gallery.scss",
9
+ ],
7
10
  output: {
8
- path: path.resolve(__dirname, 'example'),
9
- filename: 'example.js',
10
- publicPath: '/dist/'
11
+ path: path.resolve(__dirname, "example"),
12
+ filename: "example.js",
13
+ publicPath: "/dist/",
11
14
  },
12
15
  resolve: {
13
- extensions: ['.js'],
16
+ extensions: [".js", ".jsx"],
14
17
  alias: {
15
- src: path.resolve(__dirname, 'src/'),
18
+ src: path.resolve(__dirname, "src/"),
16
19
  },
17
20
  },
18
21
  module: {
19
22
  rules: [
20
23
  {
21
24
  test: /\.(js|jsx)$/,
22
- loader: 'babel-loader',
25
+ loader: "babel-loader",
23
26
  },
24
27
  {
25
28
  test: /\.(css|scss)$/i,
@@ -31,19 +34,19 @@ module.exports = {
31
34
  // Compiles Sass to CSS
32
35
  "sass-loader",
33
36
  ],
34
- }
35
- ]
37
+ },
38
+ ],
36
39
  },
37
40
  plugins: [
38
41
  new MiniCssExtractPlugin({
39
- filename: 'image-gallery.css',
42
+ filename: "image-gallery.css",
40
43
  }),
41
44
  ],
42
45
  devServer: {
43
- host: '0.0.0.0',
46
+ host: "0.0.0.0",
44
47
  port: 8001,
45
48
  historyApiFallback: {
46
- rewrites: [{ from: /\//, to: '/example/index.html' }],
49
+ rewrites: [{ from: /\//, to: "/example/index.html" }],
47
50
  },
48
51
  },
49
52
  };
package/.babelrc DELETED
@@ -1 +0,0 @@
1
- { "presets": ["@babel/preset-env", "@babel/preset-react"] }
package/.notes DELETED
@@ -1,2 +0,0 @@
1
- Great carousel lib
2
- https://splidejs.com/integration/react-splide/
package/src/Item.js DELETED
@@ -1,78 +0,0 @@
1
- import React from 'react';
2
- import { bool, func, string } from 'prop-types';
3
-
4
- const Item = React.memo(({
5
- description,
6
- fullscreen, // fullscreen version of img
7
- handleImageLoaded,
8
- isFullscreen,
9
- onImageError,
10
- original,
11
- originalAlt,
12
- originalHeight,
13
- originalWidth,
14
- originalTitle,
15
- sizes,
16
- srcSet,
17
- loading,
18
- }) => {
19
- const itemSrc = isFullscreen ? (fullscreen || original) : original;
20
-
21
- return (
22
- <React.Fragment>
23
- <img
24
- className="image-gallery-image"
25
- src={itemSrc}
26
- alt={originalAlt}
27
- srcSet={srcSet}
28
- height={originalHeight}
29
- width={originalWidth}
30
- sizes={sizes}
31
- title={originalTitle}
32
- onLoad={event => handleImageLoaded(event, original)}
33
- onError={onImageError}
34
- loading={loading}
35
- />
36
- {
37
- description && (
38
- <span className="image-gallery-description">
39
- {description}
40
- </span>
41
- )
42
- }
43
- </React.Fragment>
44
- );
45
- });
46
-
47
- Item.displayName = 'Item';
48
-
49
- Item.propTypes = {
50
- description: string,
51
- fullscreen: string, // fullscreen version of img
52
- handleImageLoaded: func.isRequired,
53
- isFullscreen: bool,
54
- onImageError: func.isRequired,
55
- original: string.isRequired,
56
- originalAlt: string,
57
- originalHeight: string,
58
- originalWidth: string,
59
- originalTitle: string,
60
- sizes: string,
61
- srcSet: string,
62
- loading: string,
63
- };
64
-
65
- Item.defaultProps = {
66
- description: '',
67
- fullscreen: '',
68
- isFullscreen: false,
69
- originalAlt: '',
70
- originalHeight: '',
71
- originalWidth: '',
72
- originalTitle: '',
73
- sizes: '',
74
- srcSet: '',
75
- loading: 'eager',
76
- };
77
-
78
- export default Item;
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- import { shallow } from 'enzyme';
3
-
4
- import ImageGallery from '../src/ImageGallery';
5
-
6
- describe('<ImageGallery />', () => {
7
- const defaultProps = {
8
- items: [],
9
- };
10
-
11
- it('matches snapshot', () => {
12
- const component = shallow(<ImageGallery {...defaultProps} />);
13
- expect(component).toMatchSnapshot();
14
- });
15
- });
@@ -1,3 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`<ImageGallery /> matches snapshot 1`] = `ShallowWrapper {}`;
@@ -1,4 +0,0 @@
1
- import Adapter from 'enzyme-adapter-react-16';
2
- import { configure } from 'enzyme';
3
-
4
- configure({ adapter: new Adapter() });