-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
27 changed files
with
769 additions
and
94 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"presets": ["@babel/preset-env", "@babel/preset-react"], | ||
"plugins": ["@babel/plugin-proposal-class-properties"] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist | ||
node_modules |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module.exports = { | ||
env: { | ||
browser: true, | ||
node: true, | ||
es6: true, | ||
}, | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:react/recommended", | ||
"prettier", | ||
"plugin:import/errors", | ||
"plugin:import/warnings", | ||
], | ||
parser: "babel-eslint", | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
ecmaVersion: 2018, | ||
sourceType: "module", | ||
}, | ||
plugins: ["react", "prettier", "import"], | ||
rules: { | ||
indent: ["error", 4], | ||
"linebreak-style": ["error", "unix"], | ||
quotes: ["error", "double"], | ||
semi: ["error", "always"], | ||
"no-console": "off", | ||
"no-prototype-builtins": "off", | ||
}, | ||
globals: { | ||
lightGallery: true, | ||
}, | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
yarn-error.log | ||
dist | ||
.example_dist | ||
.cache |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
hooks: { | ||
"pre-commit": "yarn run eslint", | ||
}, | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/node_modules | ||
/src | ||
/example | ||
/.yarn-error.log | ||
/.cache | ||
/.example_dist | ||
/.github |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 VLZH, 2023 chrobaktruhlik | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included | ||
in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"name": "modified-react-lightgallery", | ||
"version": "0.9.1", | ||
"description": "Modified React wrapper for https://github.com/sachinchoolur/lightgallery.js", | ||
"main": "src/index.js", | ||
"author": "VLZH, modified by chrobaktruhlik", | ||
"license": "MIT", | ||
"dependencies": { | ||
"browser-or-node": "^1.3.0", | ||
"hoist-non-react-statics": "^3.3.2", | ||
"lg-autoplay.js": "^1.2.0", | ||
"lg-fullscreen.js": "^1.2.0", | ||
"lg-hash.js": "^1.0.0", | ||
"lg-pager.js": "^1.0.0", | ||
"lg-share.js": "^1.3.0", | ||
"lg-thumbnail.js": "^1.2.0", | ||
"lg-video.js": "^1.2.0", | ||
"lg-zoom.js": "^1.2.0", | ||
"lightgallery.js": "^1.2.0", | ||
"lodash": "^4.17.15", | ||
"prop-types": "^15.7.2", | ||
"uniqid": "^5.2.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.10.2", | ||
"@babel/plugin-proposal-class-properties": "^7.10.1", | ||
"@babel/plugin-syntax-dynamic-import": "^7.8.3", | ||
"@babel/preset-env": "^7.10.2", | ||
"@babel/preset-react": "^7.10.1", | ||
"babel-eslint": "10.1.0", | ||
"eslint": "^7.2.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-import": "^2.21.2", | ||
"eslint-plugin-prettier": "^3.1.3", | ||
"eslint-plugin-react": "^7.20.0", | ||
"husky": "^4.2.5", | ||
"parcel-bundler": "^1.12.3", | ||
"prettier": "^2.0.5", | ||
"react": "^16.13.1", | ||
"react-dom": "^16.13.1", | ||
"rollup": "^2.15.0", | ||
"rollup-plugin-babel": "^4.4.0", | ||
"rollup-plugin-commonjs": "^10.1.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-terser": "^6.1.0", | ||
"rollup-plugin-uglify": "^6.0.3" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.13.1", | ||
"react-dom": "^16.13.1" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## About | ||
|
||
This is modified [react-lightgallery](https://github.com/VLZH/react-lightgallery) package 0.9.0 – React wrapper for: [lightgallery.js](https://sachinchoolur.github.io/lightgallery.js) | ||
|
||
Add new options to LightgalleryItem: | ||
- html [String] – Used for inserting html5 videos | ||
- poster [String] – Poster image for your video | ||
|
||
![drop](https://img.shields.io/badge/Version-0.9.1-green.svg) | ||
## Installation | ||
- Copy module to your src folder | ||
- `npm install <path>/modified-react-lightgallery --save` | ||
|
||
## Usage | ||
More info on [original repository page](https://github.com/VLZH/react-lightgallery). |
71 changes: 71 additions & 0 deletions
71
src/modules/modified-react-lightgallery/src/LightgalleryItem.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import React, { Component } from "react"; | ||
import PT from "prop-types"; | ||
import uniqid from "uniqid"; | ||
// | ||
import lightgalleryContext from "./lightgalleryContext"; | ||
import { addPrefix } from "./utils"; | ||
|
||
export class LightgalleryItem extends Component { | ||
static propTypes = { | ||
children: PT.any, | ||
group: PT.string.isRequired, | ||
src: PT.string.isRequired, | ||
thumb: PT.string, | ||
subHtml: PT.oneOfType([PT.string, PT.object]), | ||
downloadUrl: PT.string, | ||
html: PT.string, | ||
poster: PT.string, | ||
itemClassName: PT.string | ||
}; | ||
static contextType = lightgalleryContext; | ||
|
||
state = { | ||
id: uniqid(), | ||
}; | ||
|
||
componentDidMount() { | ||
this.register(); | ||
} | ||
|
||
componentWillUnmount() { | ||
this.unregister(); | ||
} | ||
|
||
/** | ||
* Register this slide in provider | ||
*/ | ||
register = () => { | ||
const { src, thumb = src, subHtml = "", downloadUrl = "", html = "", poster = "" } = this.props; | ||
this.context.registerPhoto(this.state.id, this.props.group, { | ||
src, | ||
thumb, | ||
subHtml, | ||
downloadUrl, | ||
html, | ||
poster | ||
}); | ||
}; | ||
|
||
/** | ||
* Unregister this slide in provider | ||
*/ | ||
unregister = () => { | ||
this.context.unregisterPhoto(this.state.id, this.props.group); | ||
}; | ||
|
||
/** | ||
* Open this slide | ||
*/ | ||
open = () => { | ||
this.context.openGallery(this.state.id, this.props.group); | ||
}; | ||
|
||
render() { | ||
const { itemClassName = addPrefix("item"), children } = this.props; | ||
return ( | ||
<div className={itemClassName} onClick={this.open}> | ||
{children} | ||
</div> | ||
); | ||
} | ||
} |
Oops, something went wrong.