fixed xxx/index and event binding

This commit is contained in:
bill bittner 2018-03-08 09:26:33 -08:00
parent 4f26857ed5
commit 3268f4db5b
5 changed files with 27 additions and 26 deletions

View file

@ -2,31 +2,32 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
class ExpandingTextarea extends Component { class ExpandingTextarea extends Component {
constructor (props) {
super(props);
this._handleChange = this._handleChange.bind(this);
}
componentDidMount () { componentDidMount () {
this.adjustTextarea({}); this.adjustTextarea({});
} }
_handleChange (event) {
const { onChange } = this.props;
if (onChange) onChange(event);
this.adjustTextarea(event);
}
adjustTextarea ({ target = this.el }) {
target.style.height = 0;
target.style.height = `${target.scrollHeight}px`;
}
render () { render () {
const { ...rest } = this.props; const { ...rest } = this.props;
return ( return (
<textarea <textarea
{...rest} {...rest}
ref={x => this.el = x} ref={x => this.el = x}
onChange={this._handleChange.bind(this)} onChange={this._handleChange}
/> />
); );
} }
_handleChange (event) {
const { onChange } = this.props;
if (onChange) onChange(event);
this.adjustTextarea(event);
}
adjustTextarea ({ target = this.el }) {
target.style.height = 0;
target.style.height = `${target.scrollHeight}px`;
}
} }
ExpandingTextarea.propTypes = { ExpandingTextarea.propTypes = {

View file

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import ProgressBar from 'components/ProgressBar/index'; import ProgressBar from 'components/ProgressBar';
import { LOCAL_CHECK, UNAVAILABLE, ERROR, AVAILABLE } from 'constants/asset_display_states'; import { LOCAL_CHECK, UNAVAILABLE, ERROR, AVAILABLE } from 'constants/asset_display_states';
class AssetDisplay extends React.Component { class AssetDisplay extends React.Component {

View file

@ -1,10 +1,10 @@
import React from 'react'; import React from 'react';
import SEO from 'components/SEO/index'; import SEO from 'components/SEO';
import NavBar from 'containers/NavBar/index'; import NavBar from 'containers/NavBar';
import ErrorPage from 'components/ErrorPage/index'; import ErrorPage from 'components/ErrorPage';
import AssetTitle from 'containers/AssetTitle/index'; import AssetTitle from 'containers/AssetTitle';
import AssetDisplay from 'containers/AssetDisplay/index'; import AssetDisplay from 'containers/AssetDisplay';
import AssetInfo from 'containers/AssetInfo/index'; import AssetInfo from 'containers/AssetInfo';
class ShowAssetDetails extends React.Component { class ShowAssetDetails extends React.Component {
render () { render () {

View file

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import SEO from 'components/SEO/index'; import SEO from 'components/SEO';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import AssetDisplay from 'containers/AssetDisplay/index'; import AssetDisplay from 'containers/AssetDisplay';
class ShowLite extends React.Component { class ShowLite extends React.Component {
render () { render () {

View file

@ -1,8 +1,8 @@
import React from 'react'; import React from 'react';
import SEO from 'components/SEO/index'; import SEO from 'components/SEO';
import ErrorPage from 'components/ErrorPage/index'; import ErrorPage from 'components/ErrorPage';
import NavBar from 'containers/NavBar/index'; import NavBar from 'containers/NavBar';
import ChannelClaimsDisplay from 'containers/ChannelClaimsDisplay/index'; import ChannelClaimsDisplay from 'containers/ChannelClaimsDisplay';
class ShowChannel extends React.Component { class ShowChannel extends React.Component {
render () { render () {