mirror of
https://gitlab.com/MrFry/qmining-page
synced 2025-04-01 20:23:44 +02:00
Added page titles
This commit is contained in:
parent
587c304317
commit
37060e9e69
11 changed files with 142 additions and 94 deletions
|
@ -1,4 +1,5 @@
|
|||
import React, { useState, useEffect } from 'react'
|
||||
import Head from 'next/head'
|
||||
|
||||
import LoadingIndicator from '../components/LoadingIndicator.js'
|
||||
import QuestionSearchResult from '../components/QuestionSearchResult.js'
|
||||
|
@ -23,41 +24,46 @@ export default function AllQuestions({ router, getData }) {
|
|||
})
|
||||
}, [])
|
||||
|
||||
if (data) {
|
||||
return (
|
||||
<div>
|
||||
<div className={styles.searchContainer}>
|
||||
<input
|
||||
placeholder="Keresés..."
|
||||
className={styles.searchBar}
|
||||
type="text"
|
||||
value={searchTerm}
|
||||
onChange={(e) => {
|
||||
setSearchTerm(e.target.value)
|
||||
router.replace(
|
||||
`${router.pathname}${e.target.value &&
|
||||
'?question='}${encodeURIComponent(e.target.value)}`,
|
||||
undefined,
|
||||
{ shallow: true }
|
||||
)
|
||||
}}
|
||||
/>
|
||||
<button
|
||||
onClick={() => {
|
||||
setSearchTerm('')
|
||||
}}
|
||||
className={styles.clearButton}
|
||||
>
|
||||
X
|
||||
</button>
|
||||
</div>
|
||||
<hr />
|
||||
<div>
|
||||
<QuestionSearchResult data={data} searchTerm={searchTerm} />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
} else {
|
||||
return <LoadingIndicator />
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
<Head>
|
||||
<title>Qmining - Kérdés keresés</title>
|
||||
</Head>
|
||||
{data ? (
|
||||
<>
|
||||
<div className={styles.searchContainer}>
|
||||
<input
|
||||
placeholder="Keresés..."
|
||||
className={styles.searchBar}
|
||||
type="text"
|
||||
value={searchTerm}
|
||||
onChange={(e) => {
|
||||
setSearchTerm(e.target.value)
|
||||
router.replace(
|
||||
`${router.pathname}${e.target.value &&
|
||||
'?question='}${encodeURIComponent(e.target.value)}`,
|
||||
undefined,
|
||||
{ shallow: true }
|
||||
)
|
||||
}}
|
||||
/>
|
||||
<button
|
||||
onClick={() => {
|
||||
setSearchTerm('')
|
||||
}}
|
||||
className={styles.clearButton}
|
||||
>
|
||||
X
|
||||
</button>
|
||||
</div>
|
||||
<hr />
|
||||
<div>
|
||||
<QuestionSearchResult data={data} searchTerm={searchTerm} />
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<LoadingIndicator />
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue