summaryrefslogtreecommitdiff
path: root/public/bundle.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/bundle.js')
-rw-r--r--public/bundle.js206
1 files changed, 139 insertions, 67 deletions
diff --git a/public/bundle.js b/public/bundle.js
index ab8eac2..f0b9e28 100644
--- a/public/bundle.js
+++ b/public/bundle.js
@@ -2468,11 +2468,13 @@ var _reactRouterDom = __webpack_require__(22);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-(0, _preact.render)((0, _preact.h)(
+var app = (0, _preact.h)(
_reactRouterDom.BrowserRouter,
null,
(0, _preact.h)(_App2.default, null)
-), document.getElementById('container'));
+);
+
+(0, _preact.render)(app, document.getElementById('container'));
/***/ }),
/* 20 */
@@ -2497,6 +2499,12 @@ var _db2 = _interopRequireDefault(_db);
var _lethargy = __webpack_require__(53);
+var _reactRouterDom = __webpack_require__(22);
+
+var _Scroller = __webpack_require__(55);
+
+var _Scroller2 = _interopRequireDefault(_Scroller);
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -2514,75 +2522,18 @@ var App = function (_Component) {
var _this = _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).call(this));
_this.state = {
- index: 0,
data: _db2.default.backupDB
};
- _this.lastScroll = Date.now();
- _this.onScroll = _this.onScroll.bind(_this);
- _this.lethargy = new _lethargy.Lethargy(8, 100, 1.1, 1000);
_db2.default.fetch(function (data) {
document.body.parentNode.classList.remove('loading');
_this.setState({ data: data });
});
- // document.body.addEventListener('mousewheel', this.onScroll)
- // document.body.addEventListener('DOMMouseScroll', this.onScroll)
- document.body.addEventListener('wheel', _this.onScroll);
return _this;
}
_createClass(App, [{
- key: 'onScroll',
- value: function onScroll(e) {
- e.preventDefault();
- e.stopPropagation();
- var scrollDirection = this.lethargy.check(e);
- var now = Date.now();
- if (scrollDirection !== false && now - this.lastScroll > 500) {
- this.lastScroll = now;
- var cellCount = this.state.data.painting.length;
- var index = (this.state.index + cellCount - scrollDirection) % cellCount;
- this.setState({ index: index });
- }
- }
- }, {
key: 'render',
value: function render() {
- var paintings = this.state.data.painting.map(function (painting, i) {
- return (0, _preact.h)(
- 'div',
- { 'class': 'cell', key: i },
- (0, _preact.h)(
- 'div',
- { 'class': 'painting' },
- (0, _preact.h)('div', { 'class': 'image', style: 'background-image: url(' + painting.image.uri + ')' })
- ),
- (0, _preact.h)(
- 'div',
- { 'class': 'about' },
- painting.title,
- (0, _preact.h)('br', null),
- painting.medium,
- (0, _preact.h)('br', null),
- painting.date,
- (0, _preact.h)('br', null),
- painting.image.caption,
- (0, _preact.h)('br', null)
- )
- );
- });
- var about = this.state.data.page[0];
- var body = (about.body || '').replace(/\n/g, '<br>');
- var page = (0, _preact.h)(
- 'div',
- { 'class': 'cell' },
- (0, _preact.h)(
- 'div',
- { 'class': 'painting' },
- (0, _preact.h)('div', { 'class': 'image', style: 'background-image: url(' + about.image.uri + ')' })
- ),
- (0, _preact.h)('div', { 'class': 'about', dangerouslySetInnerHTML: { __html: body } })
- );
- var scrollPercentage = this.state.index * -100;
return (0, _preact.h)(
'div',
null,
@@ -2591,14 +2542,7 @@ var App = function (_Component) {
{ 'class': 'header' },
'Procedural Paintings by Pepper'
),
- (0, _preact.h)(
- 'div',
- { 'class': 'scroller',
- style: 'transform:translateY(' + scrollPercentage + 'vh)'
- },
- paintings,
- page
- )
+ (0, _preact.h)(_Scroller2.default, { data: this.state.data })
);
}
}]);
@@ -2606,6 +2550,10 @@ var App = function (_Component) {
return App;
}(_preact.Component);
+// <Modal visible={this.props.location !== '/'}>
+// </Modal>
+
+
exports.default = App;
/***/ }),
@@ -5742,6 +5690,130 @@ exports.default = { isIphone: isIphone, isIpad: isIpad, isAndroid: isAndroid, is
}).call(this);
+/***/ }),
+/* 54 */,
+/* 55 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+var _preact = __webpack_require__(7);
+
+var _lethargy = __webpack_require__(53);
+
+var _reactRouterDom = __webpack_require__(22);
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
+
+function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
+
+var Scroller = function (_Component) {
+ _inherits(Scroller, _Component);
+
+ function Scroller() {
+ _classCallCheck(this, Scroller);
+
+ var _this = _possibleConstructorReturn(this, (Scroller.__proto__ || Object.getPrototypeOf(Scroller)).call(this));
+
+ _this.state = {
+ index: 0
+ };
+ _this.lastScroll = Date.now();
+ _this.onScroll = _this.onScroll.bind(_this);
+ _this.lethargy = new _lethargy.Lethargy(8, 100, 1.1, 1000);
+ document.body.addEventListener('wheel', _this.onScroll);
+ document.body.addEventListener('DOMMouseScroll', _this.onScroll);
+ return _this;
+ }
+
+ _createClass(Scroller, [{
+ key: 'onScroll',
+ value: function onScroll(e) {
+ e.preventDefault();
+ e.stopPropagation();
+ var scrollDirection = this.lethargy.check(e);
+ var now = Date.now();
+ if (scrollDirection !== false && now - this.lastScroll > 600) {
+ this.lastScroll = now;
+ var cellCount = this.props.data.painting.length + 1;
+ var index = (this.state.index + cellCount - scrollDirection) % cellCount;
+ this.setState({ index: index });
+ }
+ }
+ }, {
+ key: 'render',
+ value: function render() {
+ var paintings = this.props.data.painting.map(function (painting, i) {
+ return (0, _preact.h)(
+ 'div',
+ { 'class': 'cell', key: i },
+ (0, _preact.h)(
+ 'div',
+ { 'class': 'painting' },
+ (0, _preact.h)('div', { 'class': 'image', style: 'background-image: url(' + painting.image.uri + ')' })
+ ),
+ (0, _preact.h)(
+ 'div',
+ { 'class': 'about' },
+ (0, _preact.h)(
+ 'div',
+ null,
+ painting.title,
+ (0, _preact.h)('br', null),
+ painting.medium,
+ (0, _preact.h)('br', null),
+ painting.date,
+ (0, _preact.h)('br', null),
+ painting.image.caption,
+ (0, _preact.h)('br', null),
+ (0, _preact.h)('br', null),
+ (0, _preact.h)(
+ _reactRouterDom.Link,
+ { to: '/painting/' + painting.id },
+ 'More info >'
+ )
+ )
+ )
+ );
+ });
+ var about = this.props.data.page[0];
+ var body = (about.body || '').replace(/\n/g, '<br>');
+ var page = (0, _preact.h)(
+ 'div',
+ { 'class': 'cell' },
+ (0, _preact.h)(
+ 'div',
+ { 'class': 'painting' },
+ (0, _preact.h)('div', { 'class': 'image', style: 'background-image: url(' + about.image.uri + ')' })
+ ),
+ (0, _preact.h)('div', { 'class': 'about', dangerouslySetInnerHTML: { __html: body } })
+ );
+ var scrollPercentage = this.state.index * -100;
+ return (0, _preact.h)(
+ 'div',
+ { 'class': 'scroller',
+ style: 'transform:translateY(' + scrollPercentage + 'vh)'
+ },
+ paintings,
+ page
+ );
+ }
+ }]);
+
+ return Scroller;
+}(_preact.Component);
+
+exports.default = Scroller;
+
/***/ })
/******/ ]);
//# sourceMappingURL=bundle.js.map \ No newline at end of file