2017-11-09 17:10:30 -08:00
|
|
|
import React, { PureComponent } from 'react';
|
|
|
|
|
import PropTypes from 'prop-types';
|
2017-03-13 16:17:07 -07:00
|
|
|
import ChallengeTitle from '../../Challenge-Title.jsx';
|
2016-06-07 20:41:42 -07:00
|
|
|
|
2017-01-12 06:54:43 +00:00
|
|
|
const propTypes = {
|
|
|
|
|
description: PropTypes.arrayOf(PropTypes.string),
|
|
|
|
|
isCompleted: PropTypes.bool,
|
|
|
|
|
isSignedIn: PropTypes.bool,
|
|
|
|
|
title: PropTypes.string
|
|
|
|
|
};
|
2016-06-07 20:41:42 -07:00
|
|
|
|
2017-01-12 06:54:43 +00:00
|
|
|
export default class SidePanel extends PureComponent {
|
2016-06-07 20:41:42 -07:00
|
|
|
renderDescription(title = '', description = []) {
|
|
|
|
|
return description.map((line, index) => (
|
|
|
|
|
<li
|
|
|
|
|
className='step-text wrappable'
|
|
|
|
|
dangerouslySetInnerHTML={{ __html: line }}
|
|
|
|
|
key={ title.slice(6) + index }
|
|
|
|
|
/>
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
const { title, description, isCompleted } = this.props;
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
2017-03-13 16:17:07 -07:00
|
|
|
<ChallengeTitle isCompleted={ isCompleted }>
|
2016-06-07 20:41:42 -07:00
|
|
|
{ title }
|
2017-03-13 16:17:07 -07:00
|
|
|
</ChallengeTitle>
|
2016-06-07 20:41:42 -07:00
|
|
|
<ul>
|
|
|
|
|
{ this.renderDescription(title, description) }
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-01-12 06:54:43 +00:00
|
|
|
|
|
|
|
|
SidePanel.displayName = 'ProjectSidePanel';
|
|
|
|
|
SidePanel.propTypes = propTypes;
|