mirror of
https://gitlab.com/MrFry/qmining-page
synced 2025-04-01 20:23:44 +02:00
Header changes
This commit is contained in:
parent
b9248f2699
commit
e935de7e78
10 changed files with 39 additions and 22 deletions
|
@ -6,7 +6,7 @@ import Sleep from '../components/sleep'
|
|||
import constants from '../constants.json'
|
||||
|
||||
class QuestionSearchResult extends PureComponent {
|
||||
render () {
|
||||
render() {
|
||||
const { data, searchTerm } = this.props
|
||||
|
||||
let subjs = []
|
||||
|
@ -19,12 +19,15 @@ class QuestionSearchResult extends PureComponent {
|
|||
if (searchTerm) {
|
||||
subjs = data.reduce((acc, subj) => {
|
||||
const resultQuestions = subj.Questions.reduce((qacc, question) => {
|
||||
const keys = [ 'Q', 'A', 'data' ]
|
||||
const keys = ['Q', 'A', 'data']
|
||||
keys.some((key) => {
|
||||
if (typeof question[key] !== 'string') {
|
||||
return false
|
||||
}
|
||||
if (question[key] && question[key].toLowerCase().includes(searchTerm.toLowerCase())) {
|
||||
if (
|
||||
question[key] &&
|
||||
question[key].toLowerCase().includes(searchTerm.toLowerCase())
|
||||
) {
|
||||
qacc.push(question)
|
||||
return true
|
||||
}
|
||||
|
@ -34,7 +37,7 @@ class QuestionSearchResult extends PureComponent {
|
|||
if (resultQuestions.length > 0) {
|
||||
acc.push({
|
||||
Name: subj.Name,
|
||||
Questions: resultQuestions
|
||||
Questions: resultQuestions,
|
||||
})
|
||||
}
|
||||
return acc
|
||||
|
@ -48,8 +51,17 @@ class QuestionSearchResult extends PureComponent {
|
|||
return (
|
||||
<div>
|
||||
<div>
|
||||
{searchTerm ? '' : 'Kezdj el írni kereséshez!'} {results} {searchTerm ? 'találat' : 'kérdés' } {searchTerm ? subjs.length : data.length} tárgy
|
||||
{searchTerm ? '' : 'Kezdj el írni kereséshez!'} {results}{' '}
|
||||
{searchTerm ? 'találat' : 'kérdés'}{' '}
|
||||
{searchTerm ? subjs.length : data.length} tárgy
|
||||
</div>
|
||||
{results === 0 && (
|
||||
<div>
|
||||
{
|
||||
'Pontos egyezést keres a kereső, próbálj kisebb részletre keresni'
|
||||
}
|
||||
</div>
|
||||
)}
|
||||
<Sleep />
|
||||
</div>
|
||||
)
|
||||
|
@ -59,14 +71,10 @@ class QuestionSearchResult extends PureComponent {
|
|||
return renderCount()
|
||||
} else {
|
||||
return (
|
||||
<div >
|
||||
<div>
|
||||
<div>{renderCount()}</div>
|
||||
<div>
|
||||
{renderCount()}
|
||||
</div>
|
||||
<div>
|
||||
<Questions
|
||||
subjs={subjs}
|
||||
/>
|
||||
<Questions subjs={subjs} />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue