fix: wrap backend and project in Hotkeys

Co-authored-by: moT01 <tmondloch01@gmail.com>
pull/36842/head
Oliver Eyton-Williams 2019-09-18 19:02:40 +02:00 committed by mrugesh
parent c91393d737
commit af1008f4e5
2 changed files with 85 additions and 90 deletions

View File

@ -185,67 +185,68 @@ export class BackEnd extends Component {
const blockNameTitle = `${blockName} - ${title}`; const blockNameTitle = `${blockName} - ${title}`;
return ( return (
<LearnLayout> <Hotkeys
<Helmet title={`${blockNameTitle} | Learn | freeCodeCamp.org`} /> introPath={introPath}
<Hotkeys nextChallengePath={nextChallengePath}
introPath={introPath} prevChallengePath={prevChallengePath}
nextChallengePath={nextChallengePath} >
prevChallengePath={prevChallengePath} <LearnLayout>
/> <Helmet title={`${blockNameTitle} | Learn | freeCodeCamp.org`} />
<Grid> <Grid>
<Row> <Row>
<Col md={8} mdOffset={2} sm={10} smOffset={1} xs={12}> <Col md={8} mdOffset={2} sm={10} smOffset={1} xs={12}>
<Spacer /> <Spacer />
<ChallengeTitle <ChallengeTitle
introPath={introPath} introPath={introPath}
nextChallengePath={nextChallengePath} nextChallengePath={nextChallengePath}
prevChallengePath={prevChallengePath} prevChallengePath={prevChallengePath}
showPrevNextBtns={true} showPrevNextBtns={true}
> >
{blockNameTitle} {blockNameTitle}
</ChallengeTitle> </ChallengeTitle>
<ChallengeDescription <ChallengeDescription
description={description} description={description}
instructions={instructions} instructions={instructions}
/>
{challengeType === backend ? (
<Form
buttonText={`${buttonCopy}`}
formFields={formFields}
id={backendNS}
options={options}
submit={this.handleSubmit}
/> />
) : ( {challengeType === backend ? (
<ProjectForm <Form
isFrontEnd={false} buttonText={`${buttonCopy}`}
onSubmit={executeChallenge} formFields={formFields}
updateProjectForm={updateProjectFormValues} id={backendNS}
options={options}
submit={this.handleSubmit}
/>
) : (
<ProjectForm
isFrontEnd={false}
onSubmit={executeChallenge}
updateProjectForm={updateProjectFormValues}
/>
)}
<ProjectToolPanel
guideUrl={getGuideUrl({ forumTopicId, title })}
/> />
)} <br />
<ProjectToolPanel <Output
guideUrl={getGuideUrl({ forumTopicId, title })} defaultOutput={`/**
/>
<br />
<Output
defaultOutput={`/**
* *
* Test output will go here * Test output will go here
* *
* *
*/`} */`}
dimensions={this.state} dimensions={this.state}
height={150} height={150}
output={output} output={output}
/> />
<TestSuite tests={tests} /> <TestSuite tests={tests} />
<Spacer /> <Spacer />
</Col> </Col>
<CompletionModal /> <CompletionModal />
<HelpModal /> <HelpModal />
</Row> </Row>
</Grid> </Grid>
</LearnLayout> </LearnLayout>
</Hotkeys>
); );
} }
} }

View File

@ -110,42 +110,36 @@ export class Project extends Component {
const blockNameTitle = `${blockName} - ${title}`; const blockNameTitle = `${blockName} - ${title}`;
return ( return (
<LearnLayout> <Hotkeys
<Hotkeys introPath={introPath}
introPath={introPath} nextChallengePath={nextChallengePath}
nextChallengePath={nextChallengePath} prevChallengePath={prevChallengePath}
prevChallengePath={prevChallengePath} >
/> <LearnLayout>
<Helmet title={`${blockNameTitle} | Learn | freeCodeCamp.org`} /> <Helmet title={`${blockNameTitle} | Learn | freeCodeCamp.org`} />
<Grid> <Grid>
<Row> <Row>
<Col md={8} mdOffset={2} sm={10} smOffset={1} xs={12}> <Col md={8} mdOffset={2} sm={10} smOffset={1} xs={12}>
<Spacer /> <Spacer />
<ChallengeTitle <ChallengeTitle>{blockNameTitle}</ChallengeTitle>
introPath={introPath} <ChallengeDescription description={description} />
nextChallengePath={nextChallengePath} <ProjectForm
prevChallengePath={prevChallengePath} isFrontEnd={isFrontEnd}
showPrevNextBtns={true} onSubmit={openCompletionModal}
> updateProjectForm={updateProjectFormValues}
{blockNameTitle} />
</ChallengeTitle> <ProjectToolPanel
<ChallengeDescription description={description} /> guideUrl={getGuideUrl({ forumTopicId, title })}
<ProjectForm />
isFrontEnd={isFrontEnd} <br />
onSubmit={openCompletionModal} <Spacer />
updateProjectForm={updateProjectFormValues} </Col>
/> <CompletionModal />
<ProjectToolPanel <HelpModal />
guideUrl={getGuideUrl({ forumTopicId, title })} </Row>
/> </Grid>
<br /> </LearnLayout>
<Spacer /> </Hotkeys>
</Col>
<CompletionModal />
<HelpModal />
</Row>
</Grid>
</LearnLayout>
); );
} }
} }