-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add MCQ option display for MCQ Questions (#128)
* Add question prop for workspace Also made the questions in IAssessment more specific * Add mock MCQ display for MCQQuestion * Decouple editorValue from editorContainer It must now be passed as a prop. The parent that spawns an EditorContainer can take care of the value. * Simplify WorkspaceProps * Add MCQChooser * Arrange content of MCQChooser * Style components to look consistent * Add mcq question to MCQChooser * Add word wrapping * Make buttons colored * Move mcqChooser scss into workspace * Format and add tests * Fix some CSS issues (#131) * Bump version 0.1.0 -> 0.1.1
- Loading branch information
Showing
12 changed files
with
124 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Button, Card, Text, Tooltip } from '@blueprintjs/core' | ||
import * as React from 'react' | ||
|
||
import { IMCQQuestion } from '../assessment/assessmentShape' | ||
|
||
export interface IMCQChooserProps { | ||
mcq: IMCQQuestion | ||
mcqSubmit?: (choiceId: number) => void | ||
} | ||
|
||
class MCQChooser extends React.Component<IMCQChooserProps, {}> { | ||
public render() { | ||
const mockMcqSubmit = (i: number) => () => {} | ||
const options = this.props.mcq.choices.map((choice, i) => ( | ||
<Button className="mcq-option col-xs-6" onClick={mockMcqSubmit(i)}> | ||
<Tooltip key={i} content={choice.hint}> | ||
<Text className="Text"> {choice.content} </Text> | ||
</Tooltip> | ||
</Button> | ||
)) | ||
return ( | ||
<div className="MCQChooser"> | ||
<Card className="mcq-content-parent row center-xs"> | ||
<div className="col-xs-12"> | ||
<div className="mcq-task-parent row center-xs "> | ||
<Card className="mcq-task col-xs-12" elevation={2}> | ||
<Text className="Text"> {this.props.mcq.content} </Text> | ||
</Card> | ||
</div> | ||
<div className="row mcq-options-parent center-xs">{options}</div> | ||
</div> | ||
</Card> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default MCQChooser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,13 @@ | ||
import { connect, MapStateToProps } from 'react-redux' | ||
import { withRouter } from 'react-router' | ||
import Playground from '../components/Playground' | ||
|
||
export default withRouter(Playground) | ||
import Playground, { IPlaygroundProps } from '../components/Playground' | ||
import { IState } from '../reducers/states' | ||
|
||
type StateProps = Pick<IPlaygroundProps, 'editorValue'> | ||
|
||
const mapStateToProps: MapStateToProps<StateProps, {}, IState> = state => ({ | ||
editorValue: state.playground.editorValue | ||
}) | ||
|
||
export default withRouter(connect(mapStateToProps)(Playground)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import MCQChooser from '../../components/workspace/MCQChooser' | ||
|
||
export default MCQChooser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters