-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from dimorphic/development
Beta! #godspeed
- Loading branch information
Showing
86 changed files
with
3,439 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// deps | ||
import * as PokedexAPI from 'api/pokedex'; | ||
|
||
// actions types | ||
import { POKEDEX_TYPES as TYPES } from 'constants/action-types'; | ||
|
||
export const getPokemons = () => ({ | ||
type: TYPES.POKEDEX_GET_POKEMONS, | ||
payload: PokedexAPI.getAllPokemons() | ||
}); | ||
|
||
export const getPokemonById = (pokemonId) => ({ | ||
type: TYPES.POKEDEX_GET_POKEMON_BY_ID, | ||
payload: PokedexAPI.getPokemonById(pokemonId) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// deps | ||
import { create } from 'apisauce'; | ||
import { store } from '../store'; | ||
|
||
// @TODO | ||
// import RequestActions from './actions/request'; | ||
|
||
// | ||
// Le API | ||
// | ||
const API_IP = 'api.pokepedia.fyi'; // '0.0.0.0'; | ||
const API_PORT = 9090; | ||
|
||
const API = create({ | ||
baseURL: `http://${API_IP}:${API_PORT}`, | ||
headers: { | ||
// 'Authorization': TOKEN, // @TODO | ||
'Content-Type': 'application/json', | ||
'Accept': 'application/json' | ||
} | ||
}); | ||
|
||
// intercept request and add status to store | ||
const { interceptors } = API.axiosInstance; | ||
|
||
interceptors.request.use((config) => { | ||
// console.log('!!!! INTERCEPT BEFORE REQUEST !!!'); | ||
// store.dispatch(RequestActions.startLoad()); | ||
return config; | ||
}); | ||
|
||
interceptors.response.use( | ||
(response) => { | ||
// store.dispatch(RequestActions.endLoad()); | ||
return response; | ||
}, | ||
(err) => { | ||
// store.dispatch(RequestActions.errorLoad()); | ||
return Promise.reject(err); | ||
} | ||
); | ||
|
||
export default API; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Pokedex from './pokedex'; | ||
|
||
export default { | ||
pokedex: Pokedex | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// deps | ||
import API from './api'; | ||
|
||
export function getAllPokemons() { | ||
return API.get('/pokedex'); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// deps | ||
import React, { PropTypes } from 'react'; | ||
import cx from 'classnames'; | ||
import { capitalize } from 'lodash'; | ||
|
||
// style | ||
import './Grid.scss'; | ||
|
||
const Grid = (props) => { | ||
const { | ||
className, | ||
align, | ||
fit, | ||
flow, | ||
equalHeight, | ||
withGutter, | ||
spaceAround, | ||
children, | ||
...otherProps } = props; | ||
|
||
const gridClasses = cx('Grid', { | ||
[`Grid--flow${capitalize(flow)}`]: flow, | ||
[`Grid--align${capitalize(align)}`]: align, | ||
'Grid--fit': fit, | ||
'Grid--equalHeight': equalHeight, | ||
'Grid--withGutter': withGutter, | ||
'Grid--spaceAround': spaceAround | ||
}, className); | ||
|
||
|
||
return ( | ||
<div {...otherProps} className={gridClasses}> | ||
{children} | ||
</div> | ||
); | ||
}; | ||
|
||
Grid.propTypes = { | ||
align: PropTypes.oneOf(['center', 'right', 'middle', 'bottom']), | ||
fit: PropTypes.bool, | ||
flow: PropTypes.oneOf(['row', 'column']), | ||
equalHeight: PropTypes.bool, | ||
withGutter: PropTypes.bool, | ||
className: PropTypes.string, | ||
spaceAround: PropTypes.bool, | ||
children: PropTypes.node | ||
}; | ||
|
||
Grid.defaultProps = { | ||
flow: 'row' | ||
}; | ||
|
||
export default Grid; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
$grid-space: 15px; | ||
$grid-gutter: $grid-space * 2; | ||
|
||
// Inspired by https://github.com/suitcss/components-grid | ||
// DO NOT apply dimension utilities to the `Grid` element. All cell | ||
// widths should be applied to child grid cells. | ||
|
||
// All content must be contained within child `GridCell` elements. | ||
|
||
.Grid { | ||
display: flex; | ||
} | ||
|
||
// Flow order | ||
.Grid--flowRow { | ||
flex-flow: row wrap; | ||
} | ||
|
||
.Grid--flowColumn { | ||
flex-flow: column wrap; | ||
} | ||
|
||
// Alignment | ||
.Grid--alignCenter { | ||
justify-content: center; | ||
} | ||
|
||
.Grid--alignRight { | ||
justify-content: flex-end; | ||
} | ||
|
||
.Grid--spaceAround { | ||
justify-content: space-around; | ||
} | ||
|
||
.Grid--alignMiddle { | ||
align-items: center; | ||
} | ||
|
||
.Grid--alignBottom { | ||
align-items: flex-end; | ||
} | ||
|
||
// Allow cells to equal distribute width | ||
.Grid--fit > .GridCell { | ||
flex: 1 1 0%; | ||
} | ||
|
||
// All cells match height of tallest cell in a row | ||
.Grid--equalHeight > .GridCell { | ||
display: flex; | ||
} | ||
|
||
// With gutters | ||
.Grid--withGutter { | ||
margin-right: -($grid-gutter / 2); | ||
margin-left: -($grid-gutter / 2); | ||
|
||
> .GridCell { | ||
padding-right: $grid-gutter / 2; | ||
padding-left: $grid-gutter / 2; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// deps | ||
import React, { PropTypes } from 'react'; | ||
import cx from 'classnames'; | ||
|
||
// style | ||
import './GridCell.scss'; | ||
|
||
const GridCell = (props) => { | ||
const { | ||
className, | ||
col, | ||
fit, | ||
fill, | ||
full, | ||
center, | ||
children, | ||
...otherProps } = props; | ||
|
||
const gridCellClasses = cx('GridCell', { | ||
'GridCell--center': center, | ||
'GridCell--fit': fit, | ||
'GridCell--fill': fill, | ||
'GridCell--full': full, | ||
[`GridCell--col${col}`]: col | ||
}, className); | ||
|
||
return ( | ||
<div {...otherProps} className={gridCellClasses}> | ||
{children} | ||
</div> | ||
); | ||
}; | ||
|
||
GridCell.propTypes = { | ||
col: PropTypes.number, | ||
center: PropTypes.bool, | ||
fit: PropTypes.bool, | ||
fill: PropTypes.bool, | ||
full: PropTypes.bool, | ||
className: PropTypes.string, | ||
children: PropTypes.node.isRequired | ||
}; | ||
|
||
export default GridCell; |
Oops, something went wrong.