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/.eslintrc.json +42 -19
- package/.github/workflows/eslint.yml +56 -0
- package/README.md +161 -159
- package/babel.config.js +3 -0
- package/build/image-gallery.js +1 -1
- package/jest.config.js +16 -0
- package/package.json +20 -16
- package/src/{ImageGallery.js → components/ImageGallery.jsx} +443 -353
- package/src/components/ImageGallery.test.jsx +22 -0
- package/src/components/Item.jsx +75 -0
- package/src/{SVG.js → components/SVG.jsx} +16 -22
- package/src/{SwipeWrapper.js → components/SwipeWrapper.jsx} +15 -22
- package/src/{controls/Fullscreen.js → components/controls/Fullscreen.jsx} +6 -10
- package/src/{controls/LeftNav.js → components/controls/LeftNav.jsx} +5 -9
- package/src/{controls/PlayPause.js → components/controls/PlayPause.jsx} +6 -10
- package/src/{controls/RightNav.js → components/controls/RightNav.jsx} +5 -9
- package/styles/css/image-gallery.css +1 -1
- package/styles/scss/image-gallery.scss +10 -10
- package/webpack.build.js +61 -62
- package/webpack.config.js +18 -15
- package/.babelrc +0 -1
- package/.notes +0 -2
- package/src/Item.js +0 -78
- package/tests/ImageGallery.test.js +0 -15
- package/tests/__snapshots__/ImageGallery.test.js.snap +0 -3
- package/tests/setupTestFramework.js +0 -4
package/.eslintrc.json
CHANGED
|
@@ -1,24 +1,47 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
"env": {
|
|
3
|
+
"browser": true,
|
|
4
|
+
"es2021": true
|
|
5
|
+
},
|
|
6
|
+
"extends": [
|
|
7
|
+
"eslint:recommended",
|
|
8
|
+
"plugin:react/recommended",
|
|
9
|
+
"plugin:prettier/recommended", // Enable eslint-plugin-prettier and eslint-config-prettier
|
|
10
|
+
"plugin:import/errors", // Enable eslint-plugin-import
|
|
11
|
+
"plugin:import/warnings",
|
|
12
|
+
"plugin:jsx-a11y/recommended", // Enable eslint-plugin-jsx-a11y
|
|
13
|
+
"plugin:react-hooks/recommended",
|
|
14
|
+
"plugin:jest/recommended"
|
|
15
|
+
],
|
|
16
|
+
"parser": "babel-eslint",
|
|
17
|
+
"parserOptions": {
|
|
18
|
+
"ecmaFeatures": {
|
|
19
|
+
"jsx": true
|
|
5
20
|
},
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"sourceType": "module"
|
|
21
|
+
"ecmaVersion": 12,
|
|
22
|
+
"sourceType": "module"
|
|
23
|
+
},
|
|
24
|
+
"plugins": ["react", "jest"],
|
|
25
|
+
"rules": {
|
|
26
|
+
"react/display-name": "off"
|
|
27
|
+
},
|
|
28
|
+
"settings": {
|
|
29
|
+
"react": {
|
|
30
|
+
"version": "detect"
|
|
17
31
|
},
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
32
|
+
"import/resolver": {
|
|
33
|
+
"alias": {
|
|
34
|
+
"map": [["src", "./src"]],
|
|
35
|
+
"extensions": [".ts", ".js", ".jsx", ".json"]
|
|
36
|
+
}
|
|
23
37
|
}
|
|
38
|
+
},
|
|
39
|
+
"overrides": [
|
|
40
|
+
{
|
|
41
|
+
"files": ["*.js", "*.jsx"],
|
|
42
|
+
"rules": {
|
|
43
|
+
"prettier/prettier": ["error", { "trailingComma": "es5" }]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
]
|
|
24
47
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
|
2
|
+
# They are provided by a third-party and are governed by
|
|
3
|
+
# separate terms of service, privacy policy, and support
|
|
4
|
+
# documentation.
|
|
5
|
+
# ESLint is a tool for identifying and reporting on patterns
|
|
6
|
+
# found in ECMAScript/JavaScript code.
|
|
7
|
+
# More details at https://github.com/eslint/eslint
|
|
8
|
+
# and https://eslint.org
|
|
9
|
+
|
|
10
|
+
name: workflow
|
|
11
|
+
|
|
12
|
+
on:
|
|
13
|
+
push:
|
|
14
|
+
branches: ["master"]
|
|
15
|
+
pull_request:
|
|
16
|
+
# The branches below must be a subset of the branches above
|
|
17
|
+
branches: ["master"]
|
|
18
|
+
schedule:
|
|
19
|
+
- cron: "35 15 * * 3"
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
eslint:
|
|
23
|
+
name: Eslint
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
permissions:
|
|
26
|
+
contents: read
|
|
27
|
+
security-events: write
|
|
28
|
+
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
|
|
29
|
+
steps:
|
|
30
|
+
- name: Checkout code
|
|
31
|
+
uses: actions/checkout@v3
|
|
32
|
+
|
|
33
|
+
- name: Install Packages
|
|
34
|
+
run: yarn
|
|
35
|
+
|
|
36
|
+
- name: Run ESLint
|
|
37
|
+
run: yarn lint
|
|
38
|
+
continue-on-error: false
|
|
39
|
+
|
|
40
|
+
jest:
|
|
41
|
+
name: Jest
|
|
42
|
+
runs-on: ubuntu-latest
|
|
43
|
+
permissions:
|
|
44
|
+
contents: read
|
|
45
|
+
security-events: write
|
|
46
|
+
actions: read
|
|
47
|
+
steps:
|
|
48
|
+
- name: Checkout code
|
|
49
|
+
uses: actions/checkout@v3
|
|
50
|
+
|
|
51
|
+
- name: Install Packages
|
|
52
|
+
run: yarn
|
|
53
|
+
|
|
54
|
+
- name: Run Jest
|
|
55
|
+
run: yarn jest
|
|
56
|
+
continue-on-error: false
|
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
React Image Gallery
|
|
2
|
-
===
|
|
1
|
+
# React Image Gallery
|
|
3
2
|
|
|
4
3
|
[](https://badge.fury.io/js/react-image-gallery)
|
|
5
4
|
[](https://www.npmjs.com/package/react-image-gallery)
|
|
6
5
|
[](https://bundlephobia.com/package/react-image-gallery)
|
|
7
6
|
|
|
8
7
|
### Live Demo (try it on mobile for swipe support)
|
|
8
|
+
|
|
9
9
|
[`linxtion.com/demo/react-image-gallery`](http://linxtion.com/demo/react-image-gallery)
|
|
10
10
|
|
|
11
11
|

|
|
@@ -14,13 +14,13 @@ React image gallery is a React component for building image galleries and carous
|
|
|
14
14
|
|
|
15
15
|
## Features
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
- Mobile swipe gestures
|
|
18
|
+
- Thumbnail navigation
|
|
19
|
+
- Fullscreen support
|
|
20
|
+
- Custom rendered slides
|
|
21
|
+
- RTL support
|
|
22
|
+
- Responsive design
|
|
23
|
+
- Tons of customization options (see props below)
|
|
24
24
|
|
|
25
25
|
## Getting started
|
|
26
26
|
|
|
@@ -31,6 +31,7 @@ npm install react-image-gallery
|
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
### Style import (with webpack)
|
|
34
|
+
|
|
34
35
|
```
|
|
35
36
|
# SCSS
|
|
36
37
|
@import "~react-image-gallery/styles/scss/image-gallery.scss";
|
|
@@ -40,22 +41,24 @@ npm install react-image-gallery
|
|
|
40
41
|
```
|
|
41
42
|
|
|
42
43
|
### Example
|
|
44
|
+
|
|
43
45
|
Need more example? See [`example/app.js`](https://github.com/xiaolin/react-image-gallery/blob/master/example/app.js)
|
|
46
|
+
|
|
44
47
|
```js
|
|
45
|
-
import ImageGallery from
|
|
48
|
+
import ImageGallery from "react-image-gallery";
|
|
46
49
|
|
|
47
50
|
const images = [
|
|
48
51
|
{
|
|
49
|
-
original:
|
|
50
|
-
thumbnail:
|
|
52
|
+
original: "https://picsum.photos/id/1018/1000/600/",
|
|
53
|
+
thumbnail: "https://picsum.photos/id/1018/250/150/",
|
|
51
54
|
},
|
|
52
55
|
{
|
|
53
|
-
original:
|
|
54
|
-
thumbnail:
|
|
56
|
+
original: "https://picsum.photos/id/1015/1000/600/",
|
|
57
|
+
thumbnail: "https://picsum.photos/id/1015/250/150/",
|
|
55
58
|
},
|
|
56
59
|
{
|
|
57
|
-
original:
|
|
58
|
-
thumbnail:
|
|
60
|
+
original: "https://picsum.photos/id/1019/1000/600/",
|
|
61
|
+
thumbnail: "https://picsum.photos/id/1019/250/150/",
|
|
59
62
|
},
|
|
60
63
|
];
|
|
61
64
|
|
|
@@ -68,175 +71,174 @@ class MyGallery extends React.Component {
|
|
|
68
71
|
|
|
69
72
|
# Props
|
|
70
73
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
* `swipeThreshold`: Number, default `30`
|
|
134
|
-
* A percentage of how far the offset of the current slide is swiped to trigger a slide event.
|
|
74
|
+
- `items`: (required) Array of objects, see example above,
|
|
75
|
+
- Available Properties
|
|
76
|
+
- `original` - image src url
|
|
77
|
+
- `thumbnail` - image thumbnail src url
|
|
78
|
+
- `fullscreen` - image for fullscreen (defaults to original)
|
|
79
|
+
- `originalHeight` - image height (html5 attribute)
|
|
80
|
+
- `originalWidth` - image width (html5 attribute)
|
|
81
|
+
- `loading` - image loading. Either "lazy" or "eager" (html5 attribute)
|
|
82
|
+
- `thumbnailHeight` - image height (html5 attribute)
|
|
83
|
+
- `thumbnailWidth` - image width (html5 attribute)
|
|
84
|
+
- `thumbnailLoading` - image loading. Either "lazy" or "eager" (html5 attribute)
|
|
85
|
+
- `originalClass` - custom image class
|
|
86
|
+
- `thumbnailClass` - custom thumbnail class
|
|
87
|
+
- `renderItem` - Function for custom rendering a specific slide (see renderItem below)
|
|
88
|
+
- `renderThumbInner` - Function for custom thumbnail renderer (see renderThumbInner below)
|
|
89
|
+
- `originalAlt` - image alt
|
|
90
|
+
- `thumbnailAlt` - thumbnail image alt
|
|
91
|
+
- `originalTitle` - image title
|
|
92
|
+
- `thumbnailTitle` - thumbnail image title
|
|
93
|
+
- `thumbnailLabel` - label for thumbnail
|
|
94
|
+
- `description` - description for image
|
|
95
|
+
- `srcSet` - image srcset (html5 attribute)
|
|
96
|
+
- `sizes` - image sizes (html5 attribute)
|
|
97
|
+
- `bulletClass` - extra class for the bullet of the item
|
|
98
|
+
- `infinite`: Boolean, default `true`
|
|
99
|
+
- infinite sliding
|
|
100
|
+
- `lazyLoad`: Boolean, default `false`
|
|
101
|
+
- `showNav`: Boolean, default `true`
|
|
102
|
+
- `showThumbnails`: Boolean, default `true`
|
|
103
|
+
- `thumbnailPosition`: String, default `bottom`
|
|
104
|
+
- available positions: `top, right, bottom, left`
|
|
105
|
+
- `showFullscreenButton`: Boolean, default `true`
|
|
106
|
+
- `useBrowserFullscreen`: Boolean, default `true`
|
|
107
|
+
- if false, fullscreen will be done via css within the browser
|
|
108
|
+
- `useTranslate3D`: Boolean, default `true`
|
|
109
|
+
- if false, will use `translate` instead of `translate3d` css property to transition slides
|
|
110
|
+
- `showPlayButton`: Boolean, default `true`
|
|
111
|
+
- `isRTL`: Boolean, default `false`
|
|
112
|
+
- if true, gallery's direction will be from right-to-left (to support right-to-left languages)
|
|
113
|
+
- `showBullets`: Boolean, default `false`
|
|
114
|
+
- `showIndex`: Boolean, default `false`
|
|
115
|
+
- `autoPlay`: Boolean, default `false`
|
|
116
|
+
- `disableThumbnailScroll`: Boolean, default `false`
|
|
117
|
+
- disables the thumbnail container from adjusting
|
|
118
|
+
- `disableKeyDown`: Boolean, default `false`
|
|
119
|
+
- disables keydown listener for keyboard shortcuts (left arrow, right arrow, esc key)
|
|
120
|
+
- `disableSwipe`: Boolean, default `false`
|
|
121
|
+
- `disableThumbnailSwipe`: Boolean, default `false`
|
|
122
|
+
- `onErrorImageURL`: String, default `undefined`
|
|
123
|
+
- an image src pointing to your default image if an image fails to load
|
|
124
|
+
- handles both slide image, and thumbnail image
|
|
125
|
+
- `indexSeparator`: String, default `' / '`, ignored if `showIndex` is false
|
|
126
|
+
- `slideDuration`: Number, default `450`
|
|
127
|
+
- transition duration during image slide in milliseconds
|
|
128
|
+
- `swipingTransitionDuration`: Number, default `0`
|
|
129
|
+
- transition duration while swiping in milliseconds
|
|
130
|
+
- `slideInterval`: Number, default `3000`
|
|
131
|
+
- `slideOnThumbnailOver`: Boolean, default `false`
|
|
132
|
+
- `flickThreshold`: Number (float), default `0.4`
|
|
133
|
+
- Determines the max velocity of a swipe before it's considered a flick (lower = more sensitive)
|
|
134
|
+
- `swipeThreshold`: Number, default `30`
|
|
135
|
+
- A percentage of how far the offset of the current slide is swiped to trigger a slide event.
|
|
135
136
|
e.g. If the current slide is swiped less than 30% to the left or right, it will not trigger a slide event.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
137
|
+
- `stopPropagation`: Boolean, default `false`
|
|
138
|
+
- Automatically calls stopPropagation on all 'swipe' events.
|
|
139
|
+
- `startIndex`: Number, default `0`
|
|
140
|
+
- `onImageError`: Function, `callback(event)`
|
|
141
|
+
- overrides onErrorImage
|
|
142
|
+
- `onThumbnailError`: Function, `callback(event)`
|
|
143
|
+
- overrides onErrorImage
|
|
144
|
+
- `onThumbnailClick`: Function, `callback(event, index)`
|
|
145
|
+
- `onBulletClick`: Function, `callback(event, index)`
|
|
146
|
+
- `onImageLoad`: Function, `callback(event)`
|
|
147
|
+
- `onSlide`: Function, `callback(currentIndex)`
|
|
148
|
+
- `onBeforeSlide`: Function, `callback(nextIndex)`
|
|
149
|
+
- `onScreenChange`: Function, `callback(boolean)`
|
|
150
|
+
- When fullscreen is toggled a boolean is passed to the callback
|
|
151
|
+
- `onPause`: Function, `callback(currentIndex)`
|
|
152
|
+
- `onPlay`: Function, `callback(currentIndex)`
|
|
153
|
+
- `onClick`: Function, `callback(event)`
|
|
154
|
+
- `onTouchMove`: Function, `callback(event) on gallery slide`
|
|
155
|
+
- `onTouchEnd`: Function, `callback(event) on gallery slide`
|
|
156
|
+
- `onTouchStart`: Function, `callback(event) on gallery slide`
|
|
157
|
+
- `onMouseOver`: Function, `callback(event) on gallery slide`
|
|
158
|
+
- `onMouseLeave`: Function, `callback(event) on gallery slide`
|
|
159
|
+
- `additionalClass`: String,
|
|
160
|
+
- Additional class that will be added to the root node of the component.
|
|
161
|
+
- `renderCustomControls`: Function, custom controls rendering
|
|
162
|
+
- Use this to render custom controls or other elements on the currently displayed image (like the fullscreen button)
|
|
161
163
|
```javascript
|
|
162
164
|
_renderCustomControls() {
|
|
163
165
|
return <a href='' className='image-gallery-custom-action' onClick={this._customAction.bind(this)}/>
|
|
164
166
|
}
|
|
165
167
|
```
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
168
|
+
- `renderItem`: Function, custom item rendering
|
|
169
|
+
- NOTE: Highly suggest looking into a render cache such as React.memo if you plan to override renderItem
|
|
170
|
+
- On a specific item `[{thumbnail: '...', renderItem: this.myRenderItem}]`
|
|
171
|
+
- As a prop passed into `ImageGallery` to completely override `renderItem`, see source for renderItem implementation
|
|
172
|
+
- `renderThumbInner`: Function, custom thumbnail rendering
|
|
173
|
+
|
|
174
|
+
- On a specific item `[{thumbnail: '...', renderThumbInner: this.myRenderThumbInner}]`
|
|
175
|
+
- As a prop passed into `ImageGallery` to completely override `_renderThumbInner`, see source for reference
|
|
176
|
+
|
|
177
|
+
- `renderLeftNav`: Function, custom left nav component
|
|
178
|
+
- See [`<LeftNav />`](https://github.com/xiaolin/react-image-gallery/blob/master/src/components/controls/LeftNav.js)
|
|
179
|
+
- Use this to render a custom left nav control
|
|
180
|
+
- Args:
|
|
181
|
+
- `onClick` callback that will slide to the previous item
|
|
182
|
+
- `disabled` boolean for when the nav is disabled
|
|
180
183
|
```javascript
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
+
renderLeftNav: (onClick, disabled) => (
|
|
185
|
+
<LeftNav onClick={onClick} disabled={disabled} />
|
|
186
|
+
);
|
|
184
187
|
```
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
188
|
+
- `renderRightNav`: Function, custom right nav component
|
|
189
|
+
- See [`<RightNav />`](https://github.com/xiaolin/react-image-gallery/blob/master/src/components/controls/RightNav.js)
|
|
190
|
+
- Use this to render a custom right nav control
|
|
191
|
+
- Args:
|
|
192
|
+
- `onClick` callback that will slide to the next item
|
|
193
|
+
- `disabled` boolean for when the nav is disabled
|
|
191
194
|
```javascript
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
+
renderRightNav: (onClick, disabled) => (
|
|
196
|
+
<RightNav onClick={onClick} disabled={disabled} />
|
|
197
|
+
);
|
|
195
198
|
```
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
199
|
+
- `renderPlayPauseButton`: Function, play pause button component
|
|
200
|
+
- See [`<PlayPause />`](https://github.com/xiaolin/react-image-gallery/blob/master/src/components/controls/PlayPause.js)
|
|
201
|
+
- Use this to render a custom play pause button
|
|
202
|
+
- Args:
|
|
203
|
+
- `onClick` callback that will toggle play/pause
|
|
204
|
+
- `isPlaying` boolean for when gallery is playing
|
|
202
205
|
```javascript
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
+
renderPlayPauseButton: (onClick, isPlaying) => (
|
|
207
|
+
<PlayPause onClick={onClick} isPlaying={isPlaying} />
|
|
208
|
+
);
|
|
206
209
|
```
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
- `renderFullscreenButton`: Function, custom fullscreen button component
|
|
211
|
+
- See [`<Fullscreen />`](https://github.com/xiaolin/react-image-gallery/blob/master/src/components/controls/Fullscreen.js)
|
|
212
|
+
- Use this to render a custom fullscreen button
|
|
213
|
+
- Args:
|
|
214
|
+
- `onClick` callback that will toggle fullscreen
|
|
215
|
+
- `isFullscreen` argument for when fullscreen is active
|
|
213
216
|
```javascript
|
|
214
217
|
renderFullscreenButton: (onClick, isFullscreen) => (
|
|
215
218
|
<Fullscreen onClick={onClick} isFullscreen={isFullscreen} />
|
|
216
219
|
),
|
|
217
220
|
```
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
+
- `useWindowKeyDown`: Boolean, default `true`
|
|
222
|
+
- If `true`, listens to keydown events on window (window.addEventListener)
|
|
223
|
+
- If `false`, listens to keydown events on image gallery element (imageGalleryElement.addEventListener)
|
|
221
224
|
|
|
222
225
|
# Functions
|
|
223
226
|
|
|
224
227
|
The following functions can be accessed using [refs](https://reactjs.org/docs/refs-and-the-dom.html)
|
|
225
228
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
* `getCurrentIndex()`: returns the current index
|
|
229
|
+
- `play()`: plays the slides
|
|
230
|
+
- `pause()`: pauses the slides
|
|
231
|
+
- `toggleFullScreen()`: toggles full screen
|
|
232
|
+
- `slideToIndex(index)`: slides to a specific index
|
|
233
|
+
- `getCurrentIndex()`: returns the current index
|
|
232
234
|
|
|
233
235
|
# Contributing
|
|
234
236
|
|
|
235
|
-
Each PR should be specific and isolated to the issue you're trying to fix. Please do not stack features
|
|
237
|
+
Each pull request (PR) should be specific and isolated to the issue you're trying to fix. Please do not stack features, chores, refactors, or enhancements in one PR. Describe your feature/implementation in the PR. If you're unsure whether it's useful or if it involves a major change, please open an issue first and seek feedback.
|
|
236
238
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
239
|
+
- Follow eslint provided
|
|
240
|
+
- Comment your code
|
|
241
|
+
- Write [clean](https://github.com/ryanmcdermott/clean-code-javascript) code
|
|
240
242
|
|
|
241
243
|
# Build the example locally (requires node >= 12.13)
|
|
242
244
|
|
package/babel.config.js
ADDED