Render question
This commit is contained in:
@ -52,9 +52,7 @@ export default contain(
|
||||
render() {
|
||||
const {
|
||||
title,
|
||||
challengeSeed = ['1'],
|
||||
description = [],
|
||||
tests: questions
|
||||
challengeSeed = ['1']
|
||||
} = this.props.currentHike;
|
||||
|
||||
const [ id ] = challengeSeed;
|
||||
@ -70,20 +68,6 @@ export default contain(
|
||||
videoId={ id } />
|
||||
</Panel>
|
||||
</Row>
|
||||
<Row>
|
||||
<Col xs={ 12 }>
|
||||
<Panel>
|
||||
<p>
|
||||
{ description.join('\n') }
|
||||
</p>
|
||||
</Panel>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row>
|
||||
<Col xs={12}>
|
||||
{ this.renderQuestions(questions) }
|
||||
</Col>
|
||||
</Row>
|
||||
</Col>
|
||||
);
|
||||
}
|
||||
|
@ -1,19 +1,59 @@
|
||||
import React, { PropTypes } from 'react';
|
||||
import { Col, Row, Panel } from 'react-bootstrap';
|
||||
import { contain } from 'thundercats-react';
|
||||
import stampit from 'react-stampit';
|
||||
// import debugFactory from 'debug';
|
||||
|
||||
export default stampit(React, {
|
||||
displayName: 'Question',
|
||||
|
||||
propTypes: {
|
||||
params: PropTypes.object
|
||||
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',
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<h2>Question time</h2>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
propTypes: {
|
||||
params: PropTypes.object,
|
||||
currentHike: PropTypes.object,
|
||||
tests: PropTypes.array
|
||||
},
|
||||
|
||||
render() {
|
||||
const { tests: [test =[]] } = this.props;
|
||||
|
||||
const [question, answer, info] = test;
|
||||
return (
|
||||
<Col xs={ 12 }>
|
||||
<Row>
|
||||
<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