Skip to content

Commit

Permalink
Moves questions to separate component (patch)
Browse files Browse the repository at this point in the history
  • Loading branch information
zrrrzzt committed Oct 8, 2020
1 parent 07b450b commit 2a8a0a8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 26 deletions.
15 changes: 15 additions & 0 deletions components/questions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Item from './inventory-item'

const Questions = props => {
const { questions } = props
return (
<div>
<h2 className='text-2xl font-mono mt-2 mb-2'>Questions</h2>
<div>
{questions.map(item => <Item {...item} dataType='question' id={item.id} key={item.id} />)}
</div>
</div>
)
}

export default Questions
14 changes: 1 addition & 13 deletions pages/b5-costa-mccrae-300-ipip-neo-pi-r.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useEffect, useState } from 'react'
import { getInfo, getChoices, getQuestions } from '@alheimsins/b5-costa-mccrae-300-ipip-neo-pi-r'
import Instructions from '../components/instructions'
import Item from '../components/inventory-item'
import Choices from '../components/choices'
import Dropdown from '../components/dropdown-menu'
import Questions from '../components/questions'
const FileSaver = require('file-saver')
const name = 'b5-costa-mccrae-300-ipip-neo-pi-r'
const description = 'Big Five Costa and McCrae\'s 300 IPIP-NEO-PI-R items'
Expand Down Expand Up @@ -51,18 +51,6 @@ const Details = () => {
}
}

const Questions = props => {
const { questions } = props
return (
<div>
<h2 className='text-2xl font-mono mt-2 mb-2'>Questions</h2>
<div>
{questions.map(item => <Item {...item} dataType='question' id={item.id} key={item.id} />)}
</div>
</div>
)
}

const Button = () => {
return (
<button onClick={handleTranslation} className='mt-4 bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded'>
Expand Down
14 changes: 1 addition & 13 deletions pages/b5-johnson-120-ipip-neo-pi-r.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useEffect, useState } from 'react'
import { getInfo, getChoices, getQuestions } from '@alheimsins/b5-johnson-120-ipip-neo-pi-r'
import Instructions from '../components/instructions'
import Item from '../components/inventory-item'
import Choices from '../components/choices'
import Dropdown from '../components/dropdown-menu'
import Questions from '../components/questions'
const FileSaver = require('file-saver')
const name = 'b5-johnson-120-ipip-neo-pi-r'
const description = 'Big Five Johnson 120 IPIP-NEO-PI-R inventory'
Expand Down Expand Up @@ -51,18 +51,6 @@ const Details = () => {
}
}

const Questions = props => {
const { questions } = props
return (
<div>
<h2 className='text-2xl font-mono mt-2 mb-2'>Questions</h2>
<div>
{questions.map(item => <Item {...item} dataType='question' id={item.id} key={item.id} />)}
</div>
</div>
)
}

const Button = () => {
return (
<button onClick={handleTranslation} className='mt-4 bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded'>
Expand Down

0 comments on commit 2a8a0a8

Please sign in to comment.