-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Page, Question, QuestionSet and widgets components
- Loading branch information
1 parent
5e1f513
commit 0fdf1b1
Showing
15 changed files
with
295 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
import Question from '../components/Question' | ||
import QuestionSet from '../components/Question' | ||
|
||
const Page = ({ page }) => { | ||
return ( | ||
<div className="interview-page"> | ||
<h2> | ||
{page.title} | ||
</h2> | ||
{ | ||
page.elements.map((element, elementIndex) => { | ||
if (element.model == 'questions.questionset') { | ||
return <QuestionSet key={elementIndex} questionset={element} | ||
/> | ||
} else { | ||
return <Question key={elementIndex} question={element} | ||
/> | ||
} | ||
}) | ||
} | ||
</div> | ||
) | ||
} | ||
|
||
Page.propTypes = { | ||
page: PropTypes.object.isRequired | ||
} | ||
|
||
export default Page |
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,18 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
import Widget from './Widget' | ||
|
||
const Question = ({ question }) => { | ||
return ( | ||
<div className="interview-question"> | ||
<Widget question={question} /> | ||
</div> | ||
) | ||
} | ||
|
||
Question.propTypes = { | ||
question: PropTypes.object.isRequired | ||
} | ||
|
||
export default Question |
18 changes: 18 additions & 0 deletions
18
rdmo/projects/assets/js/interview/components/QuestionSet.js
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,18 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
const QuestionSet = ({ questionset }) => { | ||
console.log(questionset) | ||
|
||
return ( | ||
<div className="interview-questionset"> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
QuestionSet.propTypes = { | ||
questionset: PropTypes.object.isRequired | ||
} | ||
|
||
export default QuestionSet |
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,44 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
import Autocomplete from './widgets/Autocomplete' | ||
import Checkbox from './widgets/Checkbox' | ||
import Date from './widgets/Date' | ||
import File from './widgets/File' | ||
import Radio from './widgets/Radio' | ||
import Range from './widgets/Range' | ||
import Select from './widgets/Select' | ||
import Text from './widgets/Text' | ||
import Textarea from './widgets/Textarea' | ||
import YesNo from './widgets/YesNo' | ||
|
||
const Widget = ({ question }) => { | ||
switch (question.widget_type) { | ||
case 'autocomplete': | ||
return <Autocomplete question={question} /> | ||
case 'checkbox': | ||
return <Checkbox question={question} /> | ||
case 'date': | ||
return <Date question={question} /> | ||
case 'file': | ||
return <File question={question} /> | ||
case 'radio': | ||
return <Radio question={question} /> | ||
case 'range': | ||
return <Range question={question} /> | ||
case 'select': | ||
return <Select question={question} /> | ||
case 'text': | ||
return <Text question={question} /> | ||
case 'textarea': | ||
return <Textarea question={question} /> | ||
case 'yesno': | ||
return <YesNo question={question} /> | ||
} | ||
} | ||
|
||
Widget.propTypes = { | ||
question: PropTypes.object.isRequired | ||
} | ||
|
||
export default Widget |
18 changes: 18 additions & 0 deletions
18
rdmo/projects/assets/js/interview/components/widgets/Autocomplete.js
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,18 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
const Autocomplete = ({ question }) => { | ||
console.log(question) | ||
|
||
return ( | ||
<div> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
Autocomplete.propTypes = { | ||
question: PropTypes.object.isRequired | ||
} | ||
|
||
export default Autocomplete |
18 changes: 18 additions & 0 deletions
18
rdmo/projects/assets/js/interview/components/widgets/Checkbox.js
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,18 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
const Checkbox = ({ question }) => { | ||
console.log(question) | ||
|
||
return ( | ||
<div> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
Checkbox.propTypes = { | ||
question: PropTypes.object.isRequired | ||
} | ||
|
||
export default Checkbox |
18 changes: 18 additions & 0 deletions
18
rdmo/projects/assets/js/interview/components/widgets/Date.js
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,18 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
const Date = ({ question }) => { | ||
console.log(question) | ||
|
||
return ( | ||
<div> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
Date.propTypes = { | ||
question: PropTypes.object.isRequired | ||
} | ||
|
||
export default Date |
18 changes: 18 additions & 0 deletions
18
rdmo/projects/assets/js/interview/components/widgets/File.js
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,18 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
const File = ({ question }) => { | ||
console.log(question) | ||
|
||
return ( | ||
<div> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
File.propTypes = { | ||
question: PropTypes.object.isRequired | ||
} | ||
|
||
export default File |
18 changes: 18 additions & 0 deletions
18
rdmo/projects/assets/js/interview/components/widgets/Radio.js
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,18 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
const Radio = ({ question }) => { | ||
console.log(question) | ||
|
||
return ( | ||
<div> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
Radio.propTypes = { | ||
question: PropTypes.object.isRequired | ||
} | ||
|
||
export default Radio |
18 changes: 18 additions & 0 deletions
18
rdmo/projects/assets/js/interview/components/widgets/Range.js
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,18 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
const Range = ({ question }) => { | ||
console.log(question) | ||
|
||
return ( | ||
<div> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
Range.propTypes = { | ||
question: PropTypes.object.isRequired | ||
} | ||
|
||
export default Range |
18 changes: 18 additions & 0 deletions
18
rdmo/projects/assets/js/interview/components/widgets/Select.js
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,18 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
const Select = ({ question }) => { | ||
console.log(question) | ||
|
||
return ( | ||
<div> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
Select.propTypes = { | ||
question: PropTypes.object.isRequired | ||
} | ||
|
||
export default Select |
18 changes: 18 additions & 0 deletions
18
rdmo/projects/assets/js/interview/components/widgets/Text.js
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,18 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
const Text = ({ question }) => { | ||
console.log(question) | ||
|
||
return ( | ||
<div> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
Text.propTypes = { | ||
question: PropTypes.object.isRequired | ||
} | ||
|
||
export default Text |
18 changes: 18 additions & 0 deletions
18
rdmo/projects/assets/js/interview/components/widgets/Textarea.js
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,18 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
const Textarea = ({ question }) => { | ||
console.log(question) | ||
|
||
return ( | ||
<div> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
Textarea.propTypes = { | ||
question: PropTypes.object.isRequired | ||
} | ||
|
||
export default Textarea |
18 changes: 18 additions & 0 deletions
18
rdmo/projects/assets/js/interview/components/widgets/YesNo.js
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,18 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
const YesNo = ({ question }) => { | ||
console.log(question) | ||
|
||
return ( | ||
<div> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
YesNo.propTypes = { | ||
question: PropTypes.object.isRequired | ||
} | ||
|
||
export default YesNo |
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