react-fancybox
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -61,3 +61,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Fancybox = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
{ onClick: this.onBoxClick.bind(this), ref: 'box', className: this.props.boxClassName }, | ||
_react2['default'].createElement('img', { ref: 'imageInBox', src: this.props.imageUrl }), | ||
_react2['default'].createElement('img', { ref: 'imageInBox', src: this.props.src }), | ||
_react2['default'].createElement( | ||
@@ -73,3 +73,3 @@ 'div', | ||
null, | ||
_react2['default'].createElement('img', { onClick: this.showBox.bind(this), src: this.props.imageUrl, className: this.props.imageClassName }), | ||
_react2['default'].createElement('img', { onClick: this.showBox.bind(this), src: this.props.src, className: this.props.imageClassName }), | ||
box | ||
@@ -87,10 +87,10 @@ ); | ||
imageClassName: _react2['default'].PropTypes.string, | ||
imageUrl: _react2['default'].PropTypes.string | ||
src: _react2['default'].PropTypes.string | ||
}; | ||
Fancybox.defaultProps = { | ||
boxClassName: 'fancybox', | ||
caption: '', | ||
imageClassName: 'fancybox-img', | ||
imageUrl: '', | ||
boxClassName: 'fancybox' | ||
src: '' | ||
}; | ||
@@ -97,0 +97,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Fancybox=e()}}(function(){return function e(t,o,n){function r(a,f){if(!o[a]){if(!t[a]){var u="function"==typeof require&&require;if(!f&&u)return u(a,!0);if(i)return i(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var s=o[a]={exports:{}};t[a][0].call(s.exports,function(e){var o=t[a][1][e];return r(o?o:e)},s,s.exports,e,t,o,n)}return o[a].exports}for(var i="function"==typeof require&&require,a=0;a<n.length;a++)r(n[a]);return r}({1:[function(e,t,o){(function(e){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(o,"__esModule",{value:!0});var a=function(){function e(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,o,n){return o&&e(t.prototype,o),n&&e(t,n),t}}(),f=function(e,t,o){for(var n=!0;n;){var r=e,i=t,a=o;n=!1,null===r&&(r=Function.prototype);var f=Object.getOwnPropertyDescriptor(r,i);if(void 0!==f){if("value"in f)return f.value;var u=f.get;if(void 0===u)return;return u.call(a)}var l=Object.getPrototypeOf(r);if(null===l)return;e=l,t=i,o=a,n=!0,f=l=void 0}},u="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,l=n(u),s=function(e){function t(){r(this,t),f(Object.getPrototypeOf(t.prototype),"constructor",this).call(this),this.state={showBox:!1}}return i(t,e),a(t,[{key:"showBox",value:function(e){e.preventDefault(),this.setState({showBox:!0})}},{key:"onBoxClick",value:function(e){e.preventDefault(),e.target!=this.refs.imageInBox&&this.setState({showBox:!1})}},{key:"render",value:function(){var e="";return this.state.showBox&&(e=l["default"].createElement("div",{onClick:this.onBoxClick.bind(this),ref:"box",className:this.props.boxClassName},l["default"].createElement("img",{ref:"imageInBox",src:this.props.imageUrl}),l["default"].createElement("div",null,this.props.caption))),l["default"].createElement("div",null,l["default"].createElement("img",{onClick:this.showBox.bind(this),src:this.props.imageUrl,className:this.props.imageClassName}),e)}}]),t}(l["default"].Component);s.propTypes={boxClassName:l["default"].PropTypes.string,caption:l["default"].PropTypes.string,imageClassName:l["default"].PropTypes.string,imageUrl:l["default"].PropTypes.string},s.defaultProps={caption:"",imageClassName:"fancybox-img",imageUrl:"",boxClassName:"fancybox"},o["default"]=s,t.exports=o["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)}); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Fancybox=e()}}(function(){return function e(t,o,n){function r(a,f){if(!o[a]){if(!t[a]){var u="function"==typeof require&&require;if(!f&&u)return u(a,!0);if(i)return i(a,!0);var s=new Error("Cannot find module '"+a+"'");throw s.code="MODULE_NOT_FOUND",s}var l=o[a]={exports:{}};t[a][0].call(l.exports,function(e){var o=t[a][1][e];return r(o?o:e)},l,l.exports,e,t,o,n)}return o[a].exports}for(var i="function"==typeof require&&require,a=0;a<n.length;a++)r(n[a]);return r}({1:[function(e,t,o){(function(e){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(o,"__esModule",{value:!0});var a=function(){function e(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,o,n){return o&&e(t.prototype,o),n&&e(t,n),t}}(),f=function(e,t,o){for(var n=!0;n;){var r=e,i=t,a=o;n=!1,null===r&&(r=Function.prototype);var f=Object.getOwnPropertyDescriptor(r,i);if(void 0!==f){if("value"in f)return f.value;var u=f.get;if(void 0===u)return;return u.call(a)}var s=Object.getPrototypeOf(r);if(null===s)return;e=s,t=i,o=a,n=!0,f=s=void 0}},u="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,s=n(u),l=function(e){function t(){r(this,t),f(Object.getPrototypeOf(t.prototype),"constructor",this).call(this),this.state={showBox:!1}}return i(t,e),a(t,[{key:"showBox",value:function(e){e.preventDefault(),this.setState({showBox:!0})}},{key:"onBoxClick",value:function(e){e.preventDefault(),e.target!=this.refs.imageInBox&&this.setState({showBox:!1})}},{key:"render",value:function(){var e="";return this.state.showBox&&(e=s["default"].createElement("div",{onClick:this.onBoxClick.bind(this),ref:"box",className:this.props.boxClassName},s["default"].createElement("img",{ref:"imageInBox",src:this.props.src}),s["default"].createElement("div",null,this.props.caption))),s["default"].createElement("div",null,s["default"].createElement("img",{onClick:this.showBox.bind(this),src:this.props.src,className:this.props.imageClassName}),e)}}]),t}(s["default"].Component);l.propTypes={boxClassName:s["default"].PropTypes.string,caption:s["default"].PropTypes.string,imageClassName:s["default"].PropTypes.string,src:s["default"].PropTypes.string},l.defaultProps={boxClassName:"fancybox",caption:"",imageClassName:"fancybox-img",src:""},o["default"]=l,t.exports=o["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)}); |
@@ -59,3 +59,3 @@ 'use strict'; | ||
{ onClick: this.onBoxClick.bind(this), ref: 'box', className: this.props.boxClassName }, | ||
_react2['default'].createElement('img', { ref: 'imageInBox', src: this.props.imageUrl }), | ||
_react2['default'].createElement('img', { ref: 'imageInBox', src: this.props.src }), | ||
_react2['default'].createElement( | ||
@@ -71,3 +71,3 @@ 'div', | ||
null, | ||
_react2['default'].createElement('img', { onClick: this.showBox.bind(this), src: this.props.imageUrl, className: this.props.imageClassName }), | ||
_react2['default'].createElement('img', { onClick: this.showBox.bind(this), src: this.props.src, className: this.props.imageClassName }), | ||
box | ||
@@ -85,10 +85,10 @@ ); | ||
imageClassName: _react2['default'].PropTypes.string, | ||
imageUrl: _react2['default'].PropTypes.string | ||
src: _react2['default'].PropTypes.string | ||
}; | ||
Fancybox.defaultProps = { | ||
boxClassName: 'fancybox', | ||
caption: '', | ||
imageClassName: 'fancybox-img', | ||
imageUrl: '', | ||
boxClassName: 'fancybox' | ||
src: '' | ||
}; | ||
@@ -95,0 +95,0 @@ |
{ | ||
"name": "react-fancybox", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Fancybox", | ||
@@ -5,0 +5,0 @@ "main": "lib/Fancybox.js", |
@@ -21,9 +21,9 @@ # Fancybox | ||
``` | ||
import Fancybox from 'react-fancybox'; | ||
import ReactFancybox from 'react-fancybox'; | ||
<ReactFancybox imageUrl={url}/> | ||
import style to your scss file | ||
<ReactFancybox src={src}/> | ||
``` | ||
``` | ||
import style to your scss file | ||
@import "~react-fancybox/sass/react-fancybox.scss"; | ||
@@ -30,0 +30,0 @@ or |
@@ -31,3 +31,3 @@ import React from 'react'; | ||
<div onClick={this.onBoxClick.bind(this)} ref='box' className={this.props.boxClassName}> | ||
<img ref='imageInBox' src={this.props.imageUrl}/> | ||
<img ref='imageInBox' src={this.props.src}/> | ||
<div>{this.props.caption}</div> | ||
@@ -39,3 +39,3 @@ </div> | ||
<div> | ||
<img onClick={this.showBox.bind(this)} src={this.props.imageUrl} className={this.props.imageClassName}/> | ||
<img onClick={this.showBox.bind(this)} src={this.props.src} className={this.props.imageClassName}/> | ||
{box} | ||
@@ -51,12 +51,12 @@ </div> | ||
imageClassName: React.PropTypes.string, | ||
imageUrl: React.PropTypes.string, | ||
src: React.PropTypes.string, | ||
}; | ||
Fancybox.defaultProps = { | ||
boxClassName: 'fancybox', | ||
caption: '', | ||
imageClassName: 'fancybox-img', | ||
imageUrl: '', | ||
boxClassName: 'fancybox', | ||
src: '', | ||
}; | ||
export default Fancybox; |
Sorry, the diff of this file is not supported yet
20488