|
|
|
|
|
|
|
|
const strapi = strapiApiBuilder('articles', strapiPopulate, '?sort[0]=date&pagination[pageSize]=3'); |
|
|
const strapi = strapiApiBuilder('articles', strapiPopulate, '?sort[0]=date&pagination[pageSize]=3'); |
|
|
|
|
|
|
|
|
const [{ data, isLoading, isError }, doFetch] = useFetchCollections(strapi); |
|
|
const [{ data, isLoading, isError }, doFetch] = useFetchCollections(strapi); |
|
|
|
|
|
console.log(data); |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<div className='col-span-1 md:col-span-2 flex flex-col gap-4'> |
|
|
<div className='col-span-1 md:col-span-2 flex flex-col gap-4'> |
|
|
<h4 className='text-n-subhead font-semibold text-dark-gray mb-8'>Latest Blog Posts</h4> |
|
|
<h4 className='text-n-subhead font-semibold text-dark-gray mb-8'>Latest Blog Posts</h4> |
|
|
{data && data.map((element,index) => ( |
|
|
|
|
|
|
|
|
{data && data.length > 0 && data.map((element,index) => ( |
|
|
<a |
|
|
<a |
|
|
key={index} |
|
|
key={index} |
|
|
className={'card box flex flex-col items-center justify-between gap-[24px]'} |
|
|
className={'card box flex flex-col items-center justify-between gap-[24px]'} |
|
|
href={`/articles/${element.attributes.Slug}`} |
|
|
href={`/articles/${element.attributes.Slug}`} |
|
|
> |
|
|
> |
|
|
<div className="flex flex-col gap-[4px]"> |
|
|
<div className="flex flex-col gap-[4px]"> |
|
|
|
|
|
{element.attributes.AuthorTitle && |
|
|
<div className="flex gap-2"> |
|
|
<div className="flex gap-2"> |
|
|
<img |
|
|
|
|
|
className="max-h-[36px] object-fit rounded-full" |
|
|
|
|
|
src={api_url + element.attributes.AuthorImage.data.attributes.url} |
|
|
|
|
|
alt={api_url + element.attributes.AuthorImage.data.attributes.alternativeText} |
|
|
|
|
|
/> |
|
|
|
|
|
<div className="flex flex-col items-start"> |
|
|
|
|
|
<p className="paragraph">{element.attributes.Author}</p> |
|
|
|
|
|
<p className="text-small-subhead text-gray-400 leading-normal"> |
|
|
|
|
|
{element.attributes.AuthorTitle} |
|
|
|
|
|
</p> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
<img |
|
|
|
|
|
className="max-h-[36px] object-fit rounded-full" |
|
|
|
|
|
src={api_url + element.attributes.AuthorImage.data.attributes.url} |
|
|
|
|
|
alt={api_url + element.attributes.AuthorImage.data.attributes.alternativeText} |
|
|
|
|
|
/> |
|
|
|
|
|
<div className="flex flex-col items-start"> |
|
|
|
|
|
<p className="paragraph">{element.attributes.Author}</p> |
|
|
|
|
|
<p className="text-small-subhead text-gray-400 leading-normal"> |
|
|
|
|
|
{element.attributes.AuthorTitle} |
|
|
|
|
|
</p> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
<div className='text-left flex flex-col gap-[8px]'> |
|
|
<div className='text-left flex flex-col gap-[8px]'> |
|
|
<h2 className="n-paragraph-title text-dark-gray leading-normal">{element.attributes.ArticleTitle}</h2> |
|
|
<h2 className="n-paragraph-title text-dark-gray leading-normal">{element.attributes.ArticleTitle}</h2> |
|
|
</div> |
|
|
</div> |