Added manual and all question page

This commit is contained in:
MrFry 2020-03-08 11:22:54 +01:00
parent c19f24de87
commit 261e04a0eb
7 changed files with 257 additions and 91 deletions

View file

@ -1,9 +1,12 @@
import React, { PureComponent } from 'react'
import fetch from 'unfetch'
import LoadingIndicator from '../LoadingIndicator'
import Subject from '../../components/Subject'
import LoadingIndicator from '../components/LoadingIndicator.js'
import Subject from '../components/Subject.js'
import SubjectSelector from '../components/SubjectSelector.js'
import constants from '../../constants.json'
import constants from '../constants.json'
import Layout from '../components/layout'
class AllQuestions extends PureComponent {
constructor (props) {
@ -50,47 +53,39 @@ class AllQuestions extends PureComponent {
})
return (
<div>
<Layout currPageName='allQuestions' >
<div>
<input
placeholder='Keresés...'
className='searchBar'
type='text'
value={searchTerm}
onChange={this.searchBarOnChange.bind(this)}
/>
</div>
<div className='subjectSelector'>
{this.data.Subjects.map((subj, i) => {
if (!subj.Name.toLowerCase().includes(searchTerm.toLowerCase())) {
return null
}
<div>
<input
placeholder='Keresés...'
className='searchBar'
type='text'
value={searchTerm}
onChange={this.searchBarOnChange.bind(this)}
/>
</div>
return (
<div
className={activeSubjName === subj.Name
? 'subjItem activeSubjItem'
: 'subjItem'
}
key={i}
onClick={() => this.onSubjSelect(subj.Name)}
>
{subj.Name}
</div>
)
})}
</div>
<hr />
<div>
<Subject
subj={currSubj}
<SubjectSelector
data={this.data}
activeSubjName={activeSubjName}
searchTerm={searchTerm}
onSubjSelect={this.onSubjSelect.bind(this)}
/>
<hr />
<div>
<Subject
subj={currSubj}
/>
</div>
</div>
</div>
</Layout>
)
} else {
return (
<LoadingIndicator />
<Layout currPageName='allQuestions' >
<LoadingIndicator />
</Layout>
)
}
}