Skip to content

Commit

Permalink
pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Trost authored and Nathan Trost committed May 6, 2016
1 parent 0f5b44b commit 4ba1745
Show file tree
Hide file tree
Showing 15 changed files with 457 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@
"jQuery": true,
"$": true
}
}
}
22 changes: 11 additions & 11 deletions src/app/api/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ module.exports = {
"trade": "musician",
"avatar": "http://i.kinja-img.com/gawker-media/image/upload/s--dgxHvOTA--/18jv9qnevn0x9jpg.jpg",
"age": 23,
"bestknownfor": "Being a big Rock Star and getting kidnapped by biker gangs",
"bestknownfor": "Being a big Rock Star and getting kidnapped by Willam Dafoe led biker gangs",
"lastseen": "Streets of Fire"
},
{
Expand All @@ -68,7 +68,7 @@ module.exports = {
"trade": "writer",
"avatar": "https://s-media-cache-ak0.pinimg.com/736x/e9/d0/bc/e9d0bcf3fcb54c58228e1b6fc12d5e7c.jpg",
"age": 37,
"bestknownfor": "Losing his marbles in response to captivity and writer's block",
"bestknownfor": "Losing his marbles in response to cabin fever and writer's block",
"lastseen": "The Shining"
},
{
Expand All @@ -78,7 +78,7 @@ module.exports = {
"trade": "survivalist",
"avatar": "http://hardinthecity.files.wordpress.com/2011/12/ripley-560-thumb-560xauto-28506.jpg",
"age": 28,
"bestknownfor": "Lifelong vendetta with a xenomorph",
"bestknownfor": "Fervent racism against xenomorphs",
"lastseen": "Alien 3"
},
{
Expand Down Expand Up @@ -108,7 +108,7 @@ module.exports = {
"trade": "community organizer",
"avatar": "http://pre03.deviantart.net/a761/th/pre/i/2013/241/f/c/bill_the_butcher_by_krisskringle-d6k6kkb.jpg",
"age": 52,
"bestknownfor": "Walking around with that crazy patriotic eye",
"bestknownfor": "Walking around with a crazy patriotic eye, and of course the moustache",
"lastseen": "Gangs of New York"
},
{
Expand All @@ -118,7 +118,7 @@ module.exports = {
"trade": "actor",
"avatar": "http://cheapbossattack.files.wordpress.com/2012/09/3363489663_186273ae5a.jpg",
"age": 44,
"bestknownfor": "Being both a Therapist and an Analyst, occasionally an actor",
"bestknownfor": "Being both a Therapist and an Analyst",
"lastseen": "Arrested Development"
},
{
Expand All @@ -128,7 +128,7 @@ module.exports = {
"trade": "reporter",
"avatar": "http://2.bp.blogspot.com/-elAylodLbqM/UoXVqkRv3qI/AAAAAAAAMHA/XPYYJFcNEf0/s1600/Robin-how-i-met-your-mother-31111428-1024-768.png",
"age": 32,
"bestknownfor": "Not being the mother",
"bestknownfor": "Not being The Mother",
"lastseen": "How I Met Your Mother"
},
{
Expand All @@ -138,7 +138,7 @@ module.exports = {
"trade": "events organizer",
"avatar": "https://i.ytimg.com/vi/ReT3s0siI_Q/maxresdefault.jpg",
"age": 64,
"bestknownfor": "Being the best roadie ever, as well as keeping track of M&M's",
"bestknownfor": "Serving as God amongst all Roadies and managing M&M's for Ozzy",
"lastseen": "Wayne's World"
},
{
Expand Down Expand Up @@ -168,7 +168,7 @@ module.exports = {
"trade": "musician",
"avatar": "http://www.cinemablend.com/images/news/36820/_1365434404.gif",
"age": 45,
"bestknownfor": "Infecting the world with his mad mojo",
"bestknownfor": "Infecting the world with his mad mojo, and gracing us with his presence on Rex Manning day",
"lastseen": "Empire Records"
},
{
Expand Down Expand Up @@ -218,7 +218,7 @@ module.exports = {
"trade": "philosophy",
"avatar": "http://1.bp.blogspot.com/-5vWEYGj31LQ/Ua-aol5_IsI/AAAAAAAAHlY/mh1cL3ghpSE/s1600/oscar+the+grouch.jpeg",
"age": "unknown",
"bestknownfor": "Smelling",
"bestknownfor": "Smelling like something that gets stuck on the bottom of your shoe",
"lastseen": "Sesame Street"
},
{
Expand All @@ -228,7 +228,7 @@ module.exports = {
"trade": "community organizer",
"avatar": "https://s-media-cache-ak0.pinimg.com/736x/3d/03/bb/3d03bb7eb054f2018e671a2f9ce65036.jpg",
"age": 43,
"bestknownfor": "Being David Bowie if David Bowie lived in a land of muppets",
"bestknownfor": "Being David Bowie if David Bowie lived in a land of psychotic muppets",
"lastseen": "Labrynth"
},
{
Expand All @@ -248,7 +248,7 @@ module.exports = {
"trade": "demolitions",
"avatar": "http://i.dailymail.co.uk/i/pix/2016/02/06/20/30F2B8FA00000578-3435292-image-a-59_1454790981532.jpg",
"age": 30,
"bestknownfor": "Having a cool dad, but being way emo about it",
"bestknownfor": "Having the Coolest Dad and being way Emo about it",
"lastseen": "The Force Awakens"
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/griddle-avatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class GriddleAvatar extends React.Component{
}
render(){
return(
<Thumbnail href="#" src={this.props.rowData.avatar} className="griddle-thumb" />
<Thumbnail href="#" src={this.props.rowData.avatar} className="griddle-thumb" />
);
}
}
Expand Down
26 changes: 26 additions & 0 deletions src/app/components/griddle-custom-header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import ReactDOM from 'react-dom';

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

class GriddleCustomHeader extends React.Component{
constructor(props){
super(props);
}

render(){
return(
<span className="griddle__header">
{this.props.displayName}
</span>
);
}
}
GriddleCustomHeader.propTypes = {
rowData: React.PropTypes.object,
displayName: React.PropTypes.string
};


export default GriddleCustomHeader;
91 changes: 91 additions & 0 deletions src/app/components/griddle-custom-pager.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import React from 'react';
import ReactDOM from 'react-dom';

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

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

class GriddleCustomPager extends React.Component{
constructor(props){
super(props);
this.handleSelect = this.handleSelect.bind(this);
this.state = {
activePage: 1
};
}

getPrev() {
if (this.props.currentPage > 0) {
return (
<span className="previous">
<Glyphicon glyph="chevron-left"/>
{this.props.previousText}
</span>
);
}
}

getNext(){
if(this.props.currentPage != (this.props.maxPage -1)){
return(
<span className="next">
{this.props.nextText}
<Glyphicon glyph="chevron-right" />
</span>
);
}
}

handleSelect(eventKey) {
const maxPage = this.props.maxPage;
const page = eventKey;

if(page > maxPage || !page)
return;
this.props.setPage(page-1);
}

render(){
const maxPage = this.props.maxPage;
const pagerBsSize = this.props.pagerBsSize;

if (maxPage < 2) { return <span />; }

return (
<div className="griddle__pagination-container">
<Pagination
pagerBsSize={pagerBsSize}
items={maxPage}
next={this.getNext()}
prev={this.getPrev()}
maxButtons={Math.min(this.props.maxButtons, maxPage)}
activePage={this.props.currentPage + 1}
onSelect={this.handleSelect}
/>
</div>
);
}
}

GriddleCustomPager.propTypes = {
currentPage : React.PropTypes.number,
maxPage : React.PropTypes.number,
maxButtons : React.PropTypes.number,
nextText : React.PropTypes.string,
previousText : React.PropTypes.string,
pagerBsSize : React.PropTypes.string,
setPage : React.PropTypes.func
};

GriddleCustomPager.defaultProps = {
currentPage : 0,
maxPage : 0,
maxButtons : 10,
nextText : "Next",
previousText : "Previous",
pagerBsSize : "large"
};

export default GriddleCustomPager;
3 changes: 1 addition & 2 deletions src/app/components/griddle-name-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ import ReactDOM from 'react-dom';
//Griddle Components
import Griddle from 'griddle-react';


class GriddleNameLink extends React.Component{
constructor(props){
super(props);
}
render(){
return(
<a href={this.props.rowData.link}>{this.props.rowData.name}</a>
<a href={this.props.rowData.link} target="_blank">{this.props.rowData.name}</a>
);
}
}
Expand Down
Loading

0 comments on commit 4ba1745

Please sign in to comment.