fix(frontend-projects): replace video with image thumbnail

This commit is contained in:
Mrugesh Mohapatra
2017-06-03 14:29:37 +05:30
parent 7805d74ea7
commit 91105bdf12
4 changed files with 20 additions and 25 deletions

View File

@ -146,6 +146,7 @@ export class BackEnd extends PureComponent {
</form> </form>
</Row> </Row>
<Row> <Row>
<br/>
<Output <Output
defaultOutput={ defaultOutput={
`/** `/**

View File

@ -1,9 +1,8 @@
import React, { PropTypes } from 'react'; import React, { PropTypes } from 'react';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import Youtube from 'react-youtube';
import PureComponent from 'react-pure-render/component'; import PureComponent from 'react-pure-render/component';
import { Col, Row } from 'react-bootstrap'; import { Col, Row, Image } from 'react-bootstrap';
import SidePanel from './Side-Panel.jsx'; import SidePanel from './Side-Panel.jsx';
import ToolPanel from './Tool-Panel.jsx'; import ToolPanel from './Tool-Panel.jsx';
@ -18,13 +17,13 @@ const mapStateToProps = createSelector(
challenge: { challenge: {
id, id,
description, description,
challengeSeed: [ videoId = '' ] = [] image
} = {}, } = {},
title title
} }
) => ({ ) => ({
id, id,
videoId, image,
title, title,
description description
}) })
@ -32,9 +31,9 @@ const mapStateToProps = createSelector(
const propTypes = { const propTypes = {
description: PropTypes.arrayOf(PropTypes.string), description: PropTypes.arrayOf(PropTypes.string),
id: PropTypes.string, id: PropTypes.string,
image: PropTypes.string,
isCompleted: PropTypes.bool, isCompleted: PropTypes.bool,
title: PropTypes.string, title: PropTypes.string
videoId: PropTypes.string
}; };
export class Project extends PureComponent { export class Project extends PureComponent {
@ -42,10 +41,11 @@ export class Project extends PureComponent {
const { const {
id, id,
title, title,
videoId, image,
isCompleted, isCompleted,
description description
} = this.props; } = this.props;
const imageURL = '//i.imgur.com/' + image + '.png';
return ( return (
<Row> <Row>
<Col md={ 4 }> <Col md={ 4 }>
@ -59,9 +59,10 @@ export class Project extends PureComponent {
md={ 8 } md={ 8 }
xs={ 12 } xs={ 12 }
> >
<Youtube <Image
id={ id } id={ id }
videoId={ videoId } responsive={ true }
src={ imageURL }
/> />
<br /> <br />
<ToolPanel /> <ToolPanel />

View File

@ -65,6 +65,9 @@
"description": { "description": {
"type": "array" "type": "array"
}, },
"image": {
"type": "string"
},
"tests": { "tests": {
"type": "array" "type": "array"
}, },

View File

@ -14,9 +14,7 @@
"Once you're done, submit the URL to your working project with all its tests passing.", "Once you're done, submit the URL to your working project with all its tests passing.",
"Remember to use the <a href='https://forum.freeCodeCamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Read-Search-Ask</a> method if you get stuck." "Remember to use the <a href='https://forum.freeCodeCamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Read-Search-Ask</a> method if you get stuck."
], ],
"challengeSeed": [ "image": "A9mEKIF",
"A9mEKIF"
],
"tests": [], "tests": [],
"type": "zipline", "type": "zipline",
"isRequired": true, "isRequired": true,
@ -43,9 +41,7 @@
"Remember to use the <a href='https://forum.freeCodeCamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Read-Search-Ask</a> method if you get stuck." "Remember to use the <a href='https://forum.freeCodeCamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Read-Search-Ask</a> method if you get stuck."
], ],
"releasedOn": "January 10, 2017", "releasedOn": "January 10, 2017",
"challengeSeed": [ "image": "FFDvuCP",
"FFDvuCP"
],
"tests": [], "tests": [],
"type": "zipline", "type": "zipline",
"isRequired": true, "isRequired": true,
@ -72,9 +68,7 @@
"Remember to use the <a href='https://forum.freeCodeCamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Read-Search-Ask</a> method if you get stuck." "Remember to use the <a href='https://forum.freeCodeCamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Read-Search-Ask</a> method if you get stuck."
], ],
"releasedOn": "February 17, 2017", "releasedOn": "February 17, 2017",
"challengeSeed": [ "image": "OkeFgKL",
"OkeFgKL"
],
"tests": [], "tests": [],
"type": "zipline", "type": "zipline",
"isRequired": true, "isRequired": true,
@ -102,9 +96,7 @@
"Once you're done, submit the URL to your working project with all its tests passing.", "Once you're done, submit the URL to your working project with all its tests passing.",
"Remember to use the <a href='https://forum.freeCodeCamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Read-Search-Ask</a> method if you get stuck." "Remember to use the <a href='https://forum.freeCodeCamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Read-Search-Ask</a> method if you get stuck."
], ],
"challengeSeed": [ "image": "xlAXPjX",
"xlAXPjX"
],
"tests": [], "tests": [],
"type": "zipline", "type": "zipline",
"challengeType": 3, "challengeType": 3,
@ -126,9 +118,7 @@
"Once you're done, submit the URL to your working project with all its tests passing.", "Once you're done, submit the URL to your working project with all its tests passing.",
"Remember to use the <a href='https://forum.freeCodeCamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Read-Search-Ask</a> method if you get stuck." "Remember to use the <a href='https://forum.freeCodeCamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Read-Search-Ask</a> method if you get stuck."
], ],
"challengeSeed": [ "image": "u5RTBt4",
"u5RTBt4"
],
"tests": [], "tests": [],
"type": "zipline", "type": "zipline",
"isRequired": true, "isRequired": true,
@ -145,4 +135,4 @@
} }
} }
] ]
} }