Skip to content

Commit

Permalink
images and components for new Griddle example using vehicleData
Browse files Browse the repository at this point in the history
Also fix of some noticed bugs
  • Loading branch information
Nathan Trost authored and Nathan Trost committed Jun 9, 2016
1 parent e4ad451 commit f09802b
Show file tree
Hide file tree
Showing 40 changed files with 333 additions and 272 deletions.
124 changes: 124 additions & 0 deletions src/app/api/vehicleData.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
module.exports = {
vehicleData: [
{
'id': 0,
'Image': '../vehicles/ford-taurus-16.jpg',
'Make': 'Ford',
'Model': 'Taurus',
'Year': '2016',
'Price': '$27,110'
},
{
'id': 1,
'Image': '../vehicles/acura-rdx-08.jpg',
'Make': 'Acura',
'Model': 'RDX',
'Year': '2008',
'Price': '$17,998'
},
{
'id': 2,
'Image': '../vehicles/cadillac-cts-09.jpg',
'Make': 'Cadillac',
'Model': 'CTS',
'Year': '2009',
'Price': '$17,599'
},
{
'id': 3,
'Image': '../vehicles/bmw-335XI-11.jpg',
'Make': 'BMW',
'Model': '335 XI',
'Year': '2011',
'Price': '$22,998'
},
{
'id': 4,
'Image': '../vehicles/buick-lacrosse-12.jpg',
'Make': 'Buick',
'Model': 'LaCrosse',
'Year': '2012',
'Price': '$16,998'
},
{
'id': 5,
'Image': '../vehicles/audi-q7premium-11.jpg',
'Make': 'Audi',
'Model': 'Q7 Premium',
'Year': '2011',
'Price': '$29,998'
},
{
'id': 6,
'Image': '../vehicles/chevrolet-hhrlt-06.jpg',
'Make': 'Chevrolet',
'Model': 'HHR LT',
'Year': '2006',
'Price': '$8,998'
},
{
'id': 7,
'Image': '../vehicles/dodge-dartgt-14.jpg',
'Make': 'Dodge',
'Model': 'Dart Gt',
'Year': '2014',
'Price': '$16,998'
},
{
'id': 8,
'Image': '../vehicles/dodge-durangosxt-14.jpg',
'Make': 'Dodge',
'Model': 'Durango SXT',
'Year': '2014',
'Price': '$24,998'
},
{
'id': 9,
'Image': '../vehicles/fiat-500abarth-13.jpg',
'Make': 'Fiat',
'Model': '500 Abarth',
'Year': '2013',
'Price': '$13,998'
},
{
'id': 10,
'Image': '../vehicles/gmc-terrainsle-13.jpg',
'Make': 'GMC',
'Model': 'Terrain SLE',
'Year': '2013',
'Price': '$18,998'
},
{
'id': 11,
'Image': '../vehicles/hyundai-sonatase-13.jpg',
'Make': 'Hyundai',
'Model': 'Sonata SE',
'Year': '2013',
'Price': '$16,998'
},
{
'id': 12,
'Image': '../vehicles/hyundai-sonatasport-14.jpg',
'Make': 'Hyundai',
'Model': 'Sonata Sport',
'Year': '2014',
'Price': '$20,599'
},
{
'id': 13,
'Image': '../vehicles/infiniti-jx35-13.jpg',
'Make': 'Infiniti',
'Model': 'JX35',
'Year': '2013',
'Price': '$30,998'
},
{
'id': 14,
'Image': '../vehicles/jeep-compasslatitude-14.jpg',
'Make': 'Jeep',
'Model': 'Compass Latitude',
'Year': '2014',
'Price': '$17,998'
}
]
};
15 changes: 12 additions & 3 deletions src/app/components/griddle-responsive-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class GriddleResponsiveHeaders extends React.Component{

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

Expand All @@ -27,10 +28,16 @@ class GriddleResponsiveHeaders extends React.Component{
window.addEventListener('resize', this.handleResize);
}

componentWillUnmount() {
window.removeEventListener('resize', this.handleResize);
window.removeEventListener('load', this.handleResize);
window.removeEventListener('click', this.handleResize);
}

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


Expand All @@ -42,8 +49,10 @@ class GriddleResponsiveHeaders extends React.Component{
const displayRight = this.props.rowData[right];
return(
<div className="griddle__responsive-header">
<div className="griddle__responsive-id">
{displayName} : {columnInfo}
<div className="griddle__responsive-title-column">
<div className="griddle__responsive-id">
{columnInfo}
</div>
</div>
<div className="griddle__data">
<div className="griddle__responsive-name">
Expand Down
3 changes: 3 additions & 0 deletions src/app/components/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ class Navigation extends React.Component {
<MenuItem href="/reddit" >
Reddit
</MenuItem>
<MenuItem href="/vehicles" >
Vehicles
</MenuItem>
</Nav>
</Navbar>
);
Expand Down
78 changes: 78 additions & 0 deletions src/app/griddle-meta/vehicleDataMeta.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
//Griddle Custom Components
import GriddleResponsiveHeader from '../components/griddle-responsive-header';
import GriddleCell from '../components/griddle-cell';
import GriddleAvatar from '../components/griddle-avatar';
import GriddleCustomHeader from '../components/griddle-custom-header';

module.exports = {
columnMeta: [
{
"columnName": "Make",
"order": 0,
"sortable": true,
"locked": false,
"visible": true,
"customComponent": GriddleResponsiveHeader,
"responsiveHeaderProps": {"right": "Model"},
"displayName": "Make",
"customHeaderComponent": GriddleCustomHeader,
"customHeaderComponentProps": {"sortable": true}
},
{
"columnName": "id",
"order": 1,
"sortable": true,
"locked": false,
"visible": false,
"customComponent": GriddleCell,
"displayName": "ID",
"customHeaderComponent": GriddleCustomHeader,
"customHeaderComponentProps": {"sortable": true}
},
{
"columnName": "Model",
"order": 2,
"sortable": true,
"locked": false,
"visible": true,
"customComponent": GriddleCell,
"displayName": "Model",
"cssClassName": "griddle__responsive-hide",
"customHeaderComponent": GriddleCustomHeader,
"customHeaderComponentProps": {"sortable": true}
},
{
"columnName": "Year",
"order": 3,
"sortable": true,
"locked": false,
"visible": true,
"customComponent": GriddleCell,
"displayName": "Year",
"customHeaderComponent": GriddleCustomHeader,
"customHeaderComponentProps": {"sortable": true}
},
{
"columnName": "Image",
"order": 4,
"sortable": true,
"locked": false,
"visible": true,
"customComponent": GriddleAvatar,
"displayName": "Image",
"customHeaderComponent": GriddleCustomHeader,
"customHeaderComponentProps": {"sortable": false}
},
{
"columnName": "Price",
"order": 5,
"sortable": true,
"locked": false,
"visible": true,
"customComponent": GriddleCell,
"displayName": "Price",
"customHeaderComponent": GriddleCustomHeader,
"customHeaderComponentProps": {"sortable": true}
}
]
};
2 changes: 2 additions & 0 deletions src/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import AppLinkedItems from './pages/AppLinkedItems';
import AppAlerts from './pages/AppAlerts';
import AppGriddle from './pages/AppGriddle';
import AppGriddleReddit from './pages/AppGriddleReddit';
import AppGriddleVehicles from './pages/AppGriddleVehicles';


const store = configureStore();
Expand All @@ -32,6 +33,7 @@ ReactDOM.render((
<Route path="/alerts" component={AppAlerts} />
<Route path="/charts" component={AppGriddle} />
<Route path="/reddit" component={AppGriddleReddit} />
<Route path="/vehicles" component={AppGriddleVehicles} />
</Route>
</Router>
</Provider>
Expand Down
58 changes: 58 additions & 0 deletions src/app/pages/AppGriddleVehicles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import React, { PropTypes, Component } from 'react';

//Bootstrap Components
import { Panel, Thumbnail, Glyphicon } from 'react-bootstrap';

//Griddle Components
import Griddle from 'griddle-react';

//Griddle Custom Components

import GriddleCustomPager from '../components/griddle-custom-pager';

const vehicleData = require('../api/vehicleData').vehicleData;
const columnMeta = require('../griddle-meta/vehicleDataMeta').columnMeta;

export default class AppGriddleVehicles extends Component {
constructor(props) {
super(props);
}

render() {
return (
<div>
<h2>Vehicle Data</h2>
<Panel>
<Griddle
useGriddleStyles={false}
tableClassName="griddle-test-table"
results={vehicleData}

columnMetadata={columnMeta}

columns={[ "Make", "Model", "Year", "Price", "Image" ]}
initialSort="name"
sortAscendingComponent={<small className="griddle__header-sort-icon"><Glyphicon glyph="chevron-up" /></small>}
sortDescendingComponent={<small className="griddle__header-sort-icon"><Glyphicon glyph="chevron-down" /></small>}

nextIconComponent={<Glyphicon glyph="chevron-right" />}
previousIconComponent={<Glyphicon glyph="chevron-left" />}
settingsToggleClassName="btn btn-primary"

nextText={""}
previousText={""}


useCustomPagerComponent={true}
customPagerComponent={GriddleCustomPager}

showFilter={true}
showSettings={true}

/>
</Panel>
</div>
);
}
}

12 changes: 0 additions & 12 deletions src/app/rte-icons/icon-accept.js

This file was deleted.

12 changes: 0 additions & 12 deletions src/app/rte-icons/icon-blockquote.js

This file was deleted.

13 changes: 0 additions & 13 deletions src/app/rte-icons/icon-bold.js

This file was deleted.

12 changes: 0 additions & 12 deletions src/app/rte-icons/icon-cancel.js

This file was deleted.

12 changes: 0 additions & 12 deletions src/app/rte-icons/icon-code.js

This file was deleted.

Loading

0 comments on commit f09802b

Please sign in to comment.