add result component, env var and fetch functions

This commit is contained in:
ismailsosic
2023-02-09 15:49:17 +01:00
parent a801985548
commit bf2eebafb6
37 changed files with 175 additions and 139 deletions

View File

@@ -1,12 +1,13 @@
import React from 'react'
import Link from 'next/link'
import { useRouter } from 'next/router'
const Result = ({result}) => {
const {title, heading, writer, page} = result
const router = useRouter()
const {book, writer, text, page} = result._source
return (
<Link href="/results/[id]" as={`/results/${result.id}`} className='
<div onClick={() => (router.push({pathname: `/${result._type}/${result._id}`}))} className='
self-end
bg-[#202124]
w-[100%]
@@ -20,9 +21,9 @@ const Result = ({result}) => {
laptop:text-lg
'
>
<p className='m-3'>{heading}</p>
<p className='m-3'>"{title}" - {writer} - str. {page}.</p>
</Link>
<p className='m-3'>{text}</p>
<p className='m-3'>"{book}" - {writer} - str. {page}.</p>
</div>
)
}