| 1 |
import { useEffect, useState } from 'react'; |
| 2 |
import initialData from '../../data/docsData'; |
| 3 |
import { getDocsLength } from '../../utils/fetchDocs'; |
| 4 |
import DocCount from './DocCount'; |
| 5 |
import SearchInput from './SearchInput'; |
| 6 |
|
| 7 |
export default function HelpCenter({ |
| 8 |
searchQuery, |
| 9 |
setSearchQuery, |
| 10 |
searchResults, |
| 11 |
}) { |
| 12 |
const [articlesCount, setArticlesCount] = useState('...'); |
| 13 |
|
| 14 |
useEffect(() => { |
| 15 |
getDocsLength().then((count) => setArticlesCount(count)); |
| 16 |
}, []); |
| 17 |
|
| 18 |
const docs = [ |
| 19 |
{ |
| 20 |
label: 'Articles', |
| 21 |
count: articlesCount, |
| 22 |
}, |
| 23 |
{ |
| 24 |
label: 'Categories', |
| 25 |
count: initialData.length, |
| 26 |
}, |
| 27 |
{ |
| 28 |
label: 'Support', |
| 29 |
count: '24h', |
| 30 |
}, |
| 31 |
]; |
| 32 |
|
| 33 |
return ( |
| 34 |
<div className="disco:bg-primary-light disco:rounded-2xl disco:border disco:border-primary disco:p-7"> |
| 35 |
<div className="disco:flex disco:justify-between"> |
| 36 |
<div> |
| 37 |
<h4 className="disco:text-sm! disco:text-primary disco:font-bold!"> |
| 38 |
• Help Center |
| 39 |
</h4> |
| 40 |
<h2 className="disco:text-3xl! disco:font-extrabold! disco:pb-3"> |
| 41 |
How can we{' '} |
| 42 |
<span className="disco:text-primary">help</span> you? |
| 43 |
</h2> |
| 44 |
<p className="disco:text-sm disco:font-light "> |
| 45 |
Everything you need to set up, optimize and grow with |
| 46 |
Disco — <br /> |
| 47 |
guides, tutorials and references. |
| 48 |
</p> |
| 49 |
</div> |
| 50 |
<div className="disco:flex disco:items-start disco:gap-4"> |
| 51 |
{docs.map((doc, index) => ( |
| 52 |
<DocCount |
| 53 |
key={index} |
| 54 |
label={doc.label} |
| 55 |
count={doc.count} |
| 56 |
/> |
| 57 |
))} |
| 58 |
</div> |
| 59 |
</div> |
| 60 |
{/* Search */} |
| 61 |
<SearchInput |
| 62 |
searchQuery={searchQuery} |
| 63 |
setSearchQuery={setSearchQuery} |
| 64 |
searchResults={searchResults} |
| 65 |
/> |
| 66 |
</div> |
| 67 |
); |
| 68 |
} |
| 69 |
|