fix(layout): Improve project view (#16798)

This commit is contained in:
Stuart Taylor
2018-02-28 19:22:56 +00:00
committed by Quincy Larson
parent 76b2c13cdf
commit 12cf871249
2 changed files with 35 additions and 51 deletions

View File

@ -2,7 +2,7 @@ import React, { PureComponent } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Col, Image } from 'react-bootstrap'; import { Col } 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';
@ -14,24 +14,13 @@ import { challengeSelector } from '../../../../redux';
const mapStateToProps = createSelector( const mapStateToProps = createSelector(
challengeSelector, challengeSelector,
challengeMetaSelector, challengeMetaSelector,
( ({ description }, { title }) => ({
{
id,
description,
image
},
{ title }
) => ({
id,
image,
title, title,
description description
}) })
); );
const propTypes = { const propTypes = {
description: PropTypes.arrayOf(PropTypes.string), description: PropTypes.arrayOf(PropTypes.string),
id: PropTypes.string,
image: PropTypes.string,
isCompleted: PropTypes.bool, isCompleted: PropTypes.bool,
title: PropTypes.string title: PropTypes.string
}; };
@ -39,13 +28,10 @@ const propTypes = {
export class Project extends PureComponent { export class Project extends PureComponent {
render() { render() {
const { const {
id,
title, title,
image = 'ovKSXMs',
isCompleted, isCompleted,
description description
} = this.props; } = this.props;
const imageURL = 'https://i.imgur.com/' + image + '.png';
return ( return (
<Col <Col
md={ 8 } md={ 8 }
@ -56,11 +42,6 @@ export class Project extends PureComponent {
isCompleted={ isCompleted } isCompleted={ isCompleted }
title={ title } title={ title }
/> />
<Image
id={ id }
responsive={ true }
src={ imageURL }
/>
<br /> <br />
<ToolPanel /> <ToolPanel />
<HelpModal /> <HelpModal />

View File

@ -2,8 +2,9 @@ import React, { PureComponent } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import { Button } from 'react-bootstrap';
import { Button, ButtonGroup } from 'react-bootstrap'; import { ButtonSpacer } from '../../../../helperComponents';
import { import {
FrontEndForm, FrontEndForm,
BackEndForm BackEndForm
@ -101,9 +102,9 @@ export class ToolPanel extends PureComponent {
this.renderSubmitButton(isSignedIn, submitChallenge) : this.renderSubmitButton(isSignedIn, submitChallenge) :
<FormElement isSubmitting={ isSubmitting }/> <FormElement isSubmitting={ isSubmitting }/>
} }
<div className='button-spacer' /> <ButtonSpacer />
<ButtonGroup vertical={ true }>
<Button <Button
block={ true }
bsStyle='primary' bsStyle='primary'
className='btn-primary-ghost btn-big' className='btn-primary-ghost btn-big'
componentClass='a' componentClass='a'
@ -112,6 +113,7 @@ export class ToolPanel extends PureComponent {
> >
Help Help
</Button> </Button>
<ButtonSpacer />
<Button <Button
block={ true } block={ true }
bsStyle='primary' bsStyle='primary'
@ -121,6 +123,7 @@ export class ToolPanel extends PureComponent {
> >
Get a hint Get a hint
</Button> </Button>
<ButtonSpacer />
<Button <Button
block={ true } block={ true }
bsStyle='primary' bsStyle='primary'
@ -129,7 +132,7 @@ export class ToolPanel extends PureComponent {
> >
Ask for help on the forum Ask for help on the forum
</Button> </Button>
</ButtonGroup> <ButtonSpacer />
</div> </div>
); );
} }