Skip to content

Commit

Permalink
Finalizing responsive header/ID
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Trost authored and Nathan Trost committed May 16, 2016
1 parent c108ae9 commit d0b3303
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 26 deletions.
11 changes: 6 additions & 5 deletions src/app/components/griddle-responsive-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ import GriddleCell from '../components/griddle-cell';
class GriddleResponsiveHeaders extends React.Component{
constructor(props){
super(props);
this.state ={
responsiveView: false
};

/*
this.componentWillMount = this.componentWillMount.bind(this);
this.componentDidMount = this.componentDidMount.bind(this);
this.handleResize = this.handleResize.bind(this);
*/
}

/*

componentWillMount() {
window.addEventListener('load', this.handleResize);
window.addEventListener('click', this.handleResize);
Expand All @@ -31,7 +32,7 @@ class GriddleResponsiveHeaders extends React.Component{
const view = ( width < 992 ) ? true : false;
this.setState({responsiveView: view});
}
*/


doMobileHeader(){
const columnInfo = this.props.rowData[this.props.metadata.columnName];
Expand Down Expand Up @@ -60,7 +61,7 @@ class GriddleResponsiveHeaders extends React.Component{
}

render(){
const responsiveView = this.props.rowData.responsiveView;
const responsiveView = this.state.responsiveView;

if(responsiveView){
return this.doMobileHeader();
Expand Down
21 changes: 0 additions & 21 deletions src/app/pages/AppGriddle.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,29 +131,8 @@ const columnMeta = [
class AppGriddle extends React.Component {
constructor(props){
super(props);
this.state = {
responsiveView: false
};

this.componentWillMount = this.componentWillMount.bind(this);
this.componentDidMount = this.componentDidMount.bind(this);
this.handleResize = this.handleResize.bind(this);
}

componentWillMount() {
window.addEventListener('load', this.handleResize);
window.addEventListener('click', this.handleResize);
}

componentDidMount() {
window.addEventListener('resize', this.handleResize);
}

handleResize(e) {
const width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
const view = ( width < 992 ) ? true : false;
this.setState({responsiveView: view});
}

render() {
return (
Expand Down

0 comments on commit d0b3303

Please sign in to comment.