add map of hikes

This commit is contained in:
Berkeley Martinez
2015-07-09 00:29:29 -07:00
parent d2c858fc8c
commit bc62d18eb4
6 changed files with 115 additions and 21 deletions

View File

@ -185,10 +185,12 @@
"sort-vars": 0, "sort-vars": 0,
"space-after-keywords": [ "space-after-keywords": [
2, 2,
"always", "always"
{ "checkFunctionKeyword": false } ],
"space-before-function-paren": [
2,
"never"
], ],
"space-after-function-names": "never",
"space-before-blocks": [ "space-before-blocks": [
2, 2,
"always" "always"

View File

@ -1,22 +1,35 @@
import React, { PropTypes } from 'react'; import React, { PropTypes } from 'react';
import { Row } from 'react-bootstrap'; import stampit from 'react-stampit';
import Video from 'react-video'; import { Panel, Row } from 'react-bootstrap';
// import debugFactory from 'debug';
export default React.createClass({ import HikesMap from './Map.jsx';
// const debug = debugFactory('freecc:hikes');
export default stampit(React, {
displayName: 'Hikes', displayName: 'Hikes',
propTypes: { propTypes: {
id: PropTypes.string children: PropTypes.element
},
renderMap() {
return (
<HikesMap />
);
}, },
render() { render() {
const {
id
} = this.props.params;
return ( return (
<Video <div>
from='vimeo' <Panel>
videoId={ '132543959' } /> <h1>Hikes!</h1>
</Panel>
<Row>
{ this.props.children || this.renderMap() }
</Row>
</div>
); );
} }
}); });

View File

@ -0,0 +1,28 @@
import React, { PropTypes } from 'react';
import stampit from 'react-stampit';
import Vimeo from 'react-vimeo';
import debugFactory from 'debug';
const debug = debugFactory('freecc:hikes');
export default stampit(React, {
displayName: 'Lecture',
propTypes: {
params: PropTypes.object
},
onError: debug,
render() {
const {
id
} = this.props.params;
return (
<Vimeo
onError={ this.onError }
videoId={ id } />
);
}
});

View File

@ -0,0 +1,28 @@
import React from 'react';
import stampit from 'react-stampit';
import { Link } from 'react-router';
import { ListGroup, ListGroupItem } from 'react-bootstrap';
import videos from '../videos.json';
export default stampit(React, {
displayName: 'HikesMap',
render() {
const vidElements = videos.map(({ title, id }) => {
return (
<ListGroupItem key={ id }>
<Link to={ `/hikes/${id}` }>
<h3>{ title }</h3>
</Link>
</ListGroupItem>
);
});
return (
<ListGroup>
{ vidElements }
</ListGroup>
);
}
});

View File

@ -0,0 +1,19 @@
import React, { PropTypes } from 'react';
import stampit from 'react-stampit';
// import debugFactory from 'debug';
export default stampit(React, {
displayName: 'Question',
propTypes: {
params: PropTypes.object
},
render() {
return (
<div>
<h2>Question time</h2>
</div>
);
}
});

View File

@ -1,4 +1,6 @@
import Hikes from './components/Hikes.jsx'; import Hikes from './components/Hikes.jsx';
import Lecture from './components/Lecture.jsx';
import Question from './components/Question.jsx';
/* /*
* show video /hikes/someVideo * show video /hikes/someVideo
@ -6,11 +8,13 @@ import Hikes from './components/Hikes.jsx';
*/ */
export default { export default {
path: 'hikes(/:id)', path: 'hikes',
component: Hikes,
getComponents(cb) { childRoutes: [{
setTimeout(() => { path: ':id',
cb(null, Hikes); component: Lecture
}, 0); }, {
} path: ':id/question/:questionId',
component: Question
}]
}; };