Merge pull request #106 from tchaffee/fix/checkmarks
fix: curriculum completion checkmark styling
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
89acc49a31
commit
7c372875bf
@ -11,6 +11,7 @@ import { toggleMapModal, userSelector } from '../../../redux/app';
|
|||||||
import Caret from '../../icons/Caret';
|
import Caret from '../../icons/Caret';
|
||||||
/* eslint-disable max-len */
|
/* eslint-disable max-len */
|
||||||
import GreenPass from '../../../templates/Challenges/components/icons/GreenPass';
|
import GreenPass from '../../../templates/Challenges/components/icons/GreenPass';
|
||||||
|
import GreenNotCompleted from '../../../templates/Challenges/components/icons/GreenNotCompleted';
|
||||||
/* eslint-enable max-len */
|
/* eslint-enable max-len */
|
||||||
const mapStateToProps = (state, ownProps) => {
|
const mapStateToProps = (state, ownProps) => {
|
||||||
const expandedSelector = makeExpandedBlockSelector(ownProps.blockDashedName);
|
const expandedSelector = makeExpandedBlockSelector(ownProps.blockDashedName);
|
||||||
@ -44,6 +45,8 @@ const propTypes = {
|
|||||||
toggleMapModal: PropTypes.func.isRequired
|
toggleMapModal: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const mapIconStyle = { height: '15px', marginRight: '10px', width: '15px' };
|
||||||
|
|
||||||
export class Block extends PureComponent {
|
export class Block extends PureComponent {
|
||||||
constructor(...props) {
|
constructor(...props) {
|
||||||
super(...props);
|
super(...props);
|
||||||
@ -79,24 +82,36 @@ export class Block extends PureComponent {
|
|||||||
|
|
||||||
renderChallenges(intro, challenges) {
|
renderChallenges(intro, challenges) {
|
||||||
// TODO: Split this into a Challenge Component and add tests
|
// TODO: Split this into a Challenge Component and add tests
|
||||||
return [intro].concat(challenges).map(challenge => (
|
// TODO: The styles badge and map-badge on the completion span do not exist
|
||||||
|
return [intro].concat(challenges).map(challenge => {
|
||||||
|
const completedClass = challenge.isCompleted
|
||||||
|
? ' map-challenge-title-completed'
|
||||||
|
: '';
|
||||||
|
return (
|
||||||
<li
|
<li
|
||||||
className='map-challenge-title'
|
className={'map-challenge-title' + completedClass}
|
||||||
key={'map-challenge' + challenge.fields.slug}
|
key={'map-challenge' + challenge.fields.slug}
|
||||||
>
|
>
|
||||||
|
<span className='badge map-badge'>
|
||||||
|
{challenge.isCompleted ? (
|
||||||
|
<GreenPass
|
||||||
|
style={ mapIconStyle }
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<GreenNotCompleted
|
||||||
|
style={ mapIconStyle }
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
<Link
|
<Link
|
||||||
onClick={this.handleChallengeClick(challenge.fields.slug)}
|
onClick={this.handleChallengeClick(challenge.fields.slug)}
|
||||||
to={challenge.fields.slug}
|
to={challenge.fields.slug}
|
||||||
>
|
>
|
||||||
{challenge.title || challenge.frontmatter.title}
|
{challenge.title || challenge.frontmatter.title}
|
||||||
</Link>
|
</Link>
|
||||||
{challenge.isCompleted ? (
|
|
||||||
<span className='badge map-badge'>
|
|
||||||
<GreenPass style={{ height: '15px' }} />
|
|
||||||
</span>
|
|
||||||
) : null}
|
|
||||||
</li>
|
</li>
|
||||||
));
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -34,6 +34,19 @@ exports[`<Block expanded snapshot: block-expanded 1`] = `
|
|||||||
<li
|
<li
|
||||||
className="map-challenge-title"
|
className="map-challenge-title"
|
||||||
>
|
>
|
||||||
|
<span
|
||||||
|
className="badge map-badge"
|
||||||
|
>
|
||||||
|
<GreenNotCompleted
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"height": "15px",
|
||||||
|
"marginRight": "10px",
|
||||||
|
"width": "15px",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
<Unknown
|
<Unknown
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
to="/super-block-one/block-a"
|
to="/super-block-one/block-a"
|
||||||
@ -42,14 +55,8 @@ exports[`<Block expanded snapshot: block-expanded 1`] = `
|
|||||||
</Unknown>
|
</Unknown>
|
||||||
</li>
|
</li>
|
||||||
<li
|
<li
|
||||||
className="map-challenge-title"
|
className="map-challenge-title map-challenge-title-completed"
|
||||||
>
|
>
|
||||||
<Unknown
|
|
||||||
onClick={[Function]}
|
|
||||||
to="/super-block-one/block-a/challenge-one"
|
|
||||||
>
|
|
||||||
Challenge One
|
|
||||||
</Unknown>
|
|
||||||
<span
|
<span
|
||||||
className="badge map-badge"
|
className="badge map-badge"
|
||||||
>
|
>
|
||||||
@ -57,24 +64,12 @@ exports[`<Block expanded snapshot: block-expanded 1`] = `
|
|||||||
style={
|
style={
|
||||||
Object {
|
Object {
|
||||||
"height": "15px",
|
"height": "15px",
|
||||||
|
"marginRight": "10px",
|
||||||
|
"width": "15px",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
|
||||||
<li
|
|
||||||
className="map-challenge-title"
|
|
||||||
>
|
|
||||||
<Unknown
|
|
||||||
onClick={[Function]}
|
|
||||||
to="/super-block-one/block-a/challenge-two"
|
|
||||||
>
|
|
||||||
Challenge Two
|
|
||||||
</Unknown>
|
|
||||||
</li>
|
|
||||||
<li
|
|
||||||
className="map-challenge-title"
|
|
||||||
>
|
|
||||||
<Unknown
|
<Unknown
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
to="/super-block-one/block-a/challenge-one"
|
to="/super-block-one/block-a/challenge-one"
|
||||||
@ -85,12 +80,52 @@ exports[`<Block expanded snapshot: block-expanded 1`] = `
|
|||||||
<li
|
<li
|
||||||
className="map-challenge-title"
|
className="map-challenge-title"
|
||||||
>
|
>
|
||||||
|
<span
|
||||||
|
className="badge map-badge"
|
||||||
|
>
|
||||||
|
<GreenNotCompleted
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"height": "15px",
|
||||||
|
"marginRight": "10px",
|
||||||
|
"width": "15px",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
<Unknown
|
<Unknown
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
to="/super-block-one/block-a/challenge-two"
|
to="/super-block-one/block-a/challenge-two"
|
||||||
>
|
>
|
||||||
Challenge Two
|
Challenge Two
|
||||||
</Unknown>
|
</Unknown>
|
||||||
|
</li>
|
||||||
|
<li
|
||||||
|
className="map-challenge-title"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
className="badge map-badge"
|
||||||
|
>
|
||||||
|
<GreenNotCompleted
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"height": "15px",
|
||||||
|
"marginRight": "10px",
|
||||||
|
"width": "15px",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
<Unknown
|
||||||
|
onClick={[Function]}
|
||||||
|
to="/super-block-one/block-a/challenge-one"
|
||||||
|
>
|
||||||
|
Challenge One
|
||||||
|
</Unknown>
|
||||||
|
</li>
|
||||||
|
<li
|
||||||
|
className="map-challenge-title map-challenge-title-completed"
|
||||||
|
>
|
||||||
<span
|
<span
|
||||||
className="badge map-badge"
|
className="badge map-badge"
|
||||||
>
|
>
|
||||||
@ -98,10 +133,18 @@ exports[`<Block expanded snapshot: block-expanded 1`] = `
|
|||||||
style={
|
style={
|
||||||
Object {
|
Object {
|
||||||
"height": "15px",
|
"height": "15px",
|
||||||
|
"marginRight": "10px",
|
||||||
|
"width": "15px",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
|
<Unknown
|
||||||
|
onClick={[Function]}
|
||||||
|
to="/super-block-one/block-a/challenge-two"
|
||||||
|
>
|
||||||
|
Challenge Two
|
||||||
|
</Unknown>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
@ -27,3 +27,7 @@ li.open > .map-title svg {
|
|||||||
.map-challenge-title {
|
.map-challenge-title {
|
||||||
margin-bottom: 0.25rem;
|
margin-bottom: 0.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.map-challenge-title-completed {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
@ -86,16 +86,16 @@ const propTypes = {
|
|||||||
|
|
||||||
class ShowClassic extends PureComponent {
|
class ShowClassic extends PureComponent {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super();
|
||||||
|
|
||||||
this.resizeProps = {
|
this.resizeProps = {
|
||||||
onStopResize: this.onStopResize.bind(this),
|
onStopResize: this.onStopResize.bind(this),
|
||||||
onResize: this.onResize.bind(this)
|
onResize: this.onResize.bind(this)
|
||||||
}
|
};
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
resizing: false
|
resizing: false
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
onResize() {
|
onResize() {
|
||||||
@ -176,7 +176,9 @@ class ShowClassic extends PureComponent {
|
|||||||
.map(key => files[key])
|
.map(key => files[key])
|
||||||
.map((file, index) => (
|
.map((file, index) => (
|
||||||
<ReflexContainer key={file.key + index} orientation='horizontal'>
|
<ReflexContainer key={file.key + index} orientation='horizontal'>
|
||||||
{index !== 0 && <ReflexSplitter propagate={true} {...this.resizeProps} />}
|
{index !== 0 && (
|
||||||
|
<ReflexSplitter propagate={true} {...this.resizeProps} />
|
||||||
|
)}
|
||||||
<ReflexElement
|
<ReflexElement
|
||||||
flex={1}
|
flex={1}
|
||||||
propagateDimensions={true}
|
propagateDimensions={true}
|
||||||
@ -228,10 +230,17 @@ class ShowClassic extends PureComponent {
|
|||||||
/>
|
/>
|
||||||
</ReflexElement>
|
</ReflexElement>
|
||||||
<ReflexSplitter propagate={true} {...this.resizeProps} />
|
<ReflexSplitter propagate={true} {...this.resizeProps} />
|
||||||
<ReflexElement flex={1} {...this.resizeProps}>{editors}</ReflexElement>
|
<ReflexElement flex={1} {...this.resizeProps}>
|
||||||
|
{editors}
|
||||||
|
</ReflexElement>
|
||||||
<ReflexSplitter propagate={true} {...this.resizeProps} />
|
<ReflexSplitter propagate={true} {...this.resizeProps} />
|
||||||
<ReflexElement flex={0.5} {...this.resizeProps}>
|
<ReflexElement flex={0.5} {...this.resizeProps}>
|
||||||
{showPreview ? <Preview className='full-height' disableIframe={this.state.resizing} /> : null}
|
{showPreview ? (
|
||||||
|
<Preview
|
||||||
|
className='full-height'
|
||||||
|
disableIframe={this.state.resizing}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
<Spacer />
|
<Spacer />
|
||||||
<TestSuite tests={tests} />
|
<TestSuite tests={tests} />
|
||||||
</ReflexElement>
|
</ReflexElement>
|
||||||
|
@ -12,16 +12,16 @@ const propTypes = {
|
|||||||
|
|
||||||
class Preview extends PureComponent {
|
class Preview extends PureComponent {
|
||||||
constructor(...props) {
|
constructor(...props) {
|
||||||
super(...props)
|
super(...props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
iframeStatus: this.props.disableIframe
|
iframeStatus: this.props.disableIframe
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
if (this.props.disableIframe !== nextProps.disableIframe) {
|
if (this.props.disableIframe !== nextProps.disableIframe) {
|
||||||
this.setState({ iframeStatus: !this.state.iframeStatus })
|
this.setState({ iframeStatus: !this.state.iframeStatus });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,35 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
const propTypes = {};
|
||||||
|
|
||||||
|
function GreenNotCompleted(props) {
|
||||||
|
return (
|
||||||
|
<svg
|
||||||
|
height='50'
|
||||||
|
viewBox='0 0 200 200'
|
||||||
|
width='50'
|
||||||
|
xmlns='http://www.w3.org/2000/svg'
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
<g>
|
||||||
|
<title>Not Passed</title>
|
||||||
|
<circle
|
||||||
|
cx='100'
|
||||||
|
cy='99'
|
||||||
|
fill='#FFFFFF'
|
||||||
|
r='95'
|
||||||
|
stroke='#006400'
|
||||||
|
strokeDasharray='null'
|
||||||
|
strokeLinecap='null'
|
||||||
|
strokeLinejoin='null'
|
||||||
|
strokeWidth='5'
|
||||||
|
/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
GreenNotCompleted.displayName = 'GreenNotCompleted';
|
||||||
|
GreenNotCompleted.propTypes = propTypes;
|
||||||
|
|
||||||
|
export default GreenNotCompleted;
|
@ -23,3 +23,8 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
margin-left: 3px;
|
margin-left: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.test-status-icon > svg {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
}
|
Reference in New Issue
Block a user