Snow rendering changes, allquestions page fixes and improvements

This commit is contained in:
mrfry 2020-12-26 17:26:08 +01:00
parent d15e79e6ac
commit 5a1bd258bc
3 changed files with 34 additions and 28 deletions

View file

@ -4,6 +4,10 @@ import Questions from './Questions.js'
import constants from '../constants.json'
const countReducer = (acc, subj) => {
return acc + subj.Questions.length
}
class QuestionSearchResult extends PureComponent {
render() {
const { data, searchTerm } = this.props
@ -11,10 +15,6 @@ class QuestionSearchResult extends PureComponent {
let subjs = []
let results = -1
const countReducer = (acc, subj) => {
return acc + subj.Questions.length
}
if (searchTerm) {
subjs = data.reduce((acc, subj) => {
const resultQuestions = subj.Questions.reduce((qacc, question) => {
@ -50,9 +50,8 @@ 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} találat, ${subjs.length} tárgyból`}
</div>
{results === 0 && (
<div>