Misc Frontend Updates

This commit is contained in:
Qstick 2017-09-26 21:33:39 -04:00
parent 729d1142b0
commit f69559e4da
11 changed files with 107 additions and 46 deletions

View file

@ -1,6 +1,7 @@
import PropTypes from 'prop-types';
import React from 'react';
import styles from './Form.css';
import { kinds } from 'Helpers/Props';
import Alert from 'Components/Alert';
function Form({ children, validationErrors, validationWarnings, ...otherProps }) {
return (
@ -9,12 +10,12 @@ function Form({ children, validationErrors, validationWarnings, ...otherProps })
{
validationErrors.map((error, index) => {
return (
<div
<Alert
key={index}
className={styles.error}
kind={kinds.DANGER}
>
{error.errorMessage}
</div>
</Alert>
);
})
}
@ -22,12 +23,12 @@ function Form({ children, validationErrors, validationWarnings, ...otherProps })
{
validationWarnings.map((warning, index) => {
return (
<div
<Alert
key={index}
className={styles.error}
kind={kinds.WARNING}
>
{warning.errorMessage}
</div>
</Alert>
);
})
}

View file

@ -247,9 +247,9 @@ class PageSidebar extends Component {
window.addEventListener('click', this.onWindowClick, { capture: true });
window.addEventListener('scroll', this.onWindowScroll);
window.addEventListener('touchstart', this.onTouchStart);
window.addEventListener('touchmove', this.onTouchMove);
window.addEventListener('touchend', this.onTouchEnd);
window.addEventListener('touchcancel', this.onTouchCancel);
window.addEventListener('touchmove', this.onTouchMove);
}
}
@ -274,9 +274,9 @@ class PageSidebar extends Component {
window.removeEventListener('click', this.onWindowClick, { capture: true });
window.removeEventListener('scroll', this.onWindowScroll);
window.removeEventListener('touchstart', this.onTouchStart);
window.removeEventListener('touchmove', this.onTouchMove);
window.removeEventListener('touchend', this.onTouchEnd);
window.removeEventListener('touchcancel', this.onTouchCancel);
window.removeEventListener('touchmove', this.onTouchMove);
}
}
@ -322,20 +322,22 @@ class PageSidebar extends Component {
onTouchStart = (event) => {
const touches = event.touches;
const touchStart = touches[0].pageX;
const touchStartX = touches[0].pageX;
const touchStartY = touches[0].pageY;
const isSidebarVisible = this.props.isSidebarVisible;
if (touches.length !== 1) {
return;
}
if (isSidebarVisible && (touchStart > 210 || touchStart < 50)) {
if (isSidebarVisible && (touchStartX > 210 || touchStartX < 50)) {
return;
} else if (!isSidebarVisible && touchStart > 50) {
} else if (!isSidebarVisible && touchStartX > 50) {
return;
}
this._touchStartX = touchStart;
this._touchStartX = touchStartX;
this._touchStartY = touchStartY;
}
onTouchEnd = (event) => {