Render question
This commit is contained in:
@ -52,9 +52,7 @@ export default contain(
|
|||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
title,
|
title,
|
||||||
challengeSeed = ['1'],
|
challengeSeed = ['1']
|
||||||
description = [],
|
|
||||||
tests: questions
|
|
||||||
} = this.props.currentHike;
|
} = this.props.currentHike;
|
||||||
|
|
||||||
const [ id ] = challengeSeed;
|
const [ id ] = challengeSeed;
|
||||||
@ -70,20 +68,6 @@ export default contain(
|
|||||||
videoId={ id } />
|
videoId={ id } />
|
||||||
</Panel>
|
</Panel>
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
|
||||||
<Col xs={ 12 }>
|
|
||||||
<Panel>
|
|
||||||
<p>
|
|
||||||
{ description.join('\n') }
|
|
||||||
</p>
|
|
||||||
</Panel>
|
|
||||||
</Col>
|
|
||||||
</Row>
|
|
||||||
<Row>
|
|
||||||
<Col xs={12}>
|
|
||||||
{ this.renderQuestions(questions) }
|
|
||||||
</Col>
|
|
||||||
</Row>
|
|
||||||
</Col>
|
</Col>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,59 @@
|
|||||||
import React, { PropTypes } from 'react';
|
import React, { PropTypes } from 'react';
|
||||||
|
import { Col, Row, Panel } from 'react-bootstrap';
|
||||||
|
import { contain } from 'thundercats-react';
|
||||||
import stampit from 'react-stampit';
|
import stampit from 'react-stampit';
|
||||||
// import debugFactory from 'debug';
|
// import debugFactory from 'debug';
|
||||||
|
|
||||||
export default stampit(React, {
|
export default contain(
|
||||||
|
{
|
||||||
|
store: 'hikesStore',
|
||||||
|
map({ hikes, currentHike }) {
|
||||||
|
const { tests = [] } = currentHike;
|
||||||
|
return {
|
||||||
|
hikes,
|
||||||
|
currentHike,
|
||||||
|
tests
|
||||||
|
};
|
||||||
|
},
|
||||||
|
fetchAction: 'hikesActions.getHike',
|
||||||
|
getPayload({ currentHike, hikes, params: { dashedName } }) {
|
||||||
|
const filterRegex = new RegExp(dashedName, 'i');
|
||||||
|
if (currentHike && filterRegex.test(currentHike.dashedName)) {
|
||||||
|
return {
|
||||||
|
hikes: [],
|
||||||
|
isPrimed: true,
|
||||||
|
dashedName
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
hikes,
|
||||||
|
isPrimed: false,
|
||||||
|
dashedName: dashedName
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
stampit(React, {
|
||||||
displayName: 'Question',
|
displayName: 'Question',
|
||||||
|
|
||||||
propTypes: {
|
propTypes: {
|
||||||
params: PropTypes.object
|
params: PropTypes.object,
|
||||||
|
currentHike: PropTypes.object,
|
||||||
|
tests: PropTypes.array
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const { tests: [test =[]] } = this.props;
|
||||||
|
|
||||||
|
const [question, answer, info] = test;
|
||||||
return (
|
return (
|
||||||
<div>
|
<Col xs={ 12 }>
|
||||||
<h2>Question time</h2>
|
<Row>
|
||||||
</div>
|
<Panel>
|
||||||
|
<p>{ question }</p>
|
||||||
|
</Panel>
|
||||||
|
</Row>
|
||||||
|
</Col>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
);
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
{
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
[{
|
|
||||||
"title": "FCC Computer Basics 1: the 4 basic parts of a computer",
|
|
||||||
"id": "132542064"
|
|
||||||
}, {
|
|
||||||
"title": "FCC Computer Basics 2: More Computer Hardware",
|
|
||||||
"id": "132542458"
|
|
||||||
}, {
|
|
||||||
"title": "FCC Computer Basics 3: Intro to Binary Code",
|
|
||||||
"id": "132542757"
|
|
||||||
}, {
|
|
||||||
"title": "FCC Computer Basics 4: Decoding a Binary Number",
|
|
||||||
"id": "132543332"
|
|
||||||
}, {
|
|
||||||
"title": "FCC Computer Basics 5: How To Measure Data Size",
|
|
||||||
"id": "132543959"
|
|
||||||
}]
|
|
Reference in New Issue
Block a user