Files
supabase/apps/www/components/Blog/FeaturedThumb.tsx
Jonathan Summers-MuirandFrancesco Sansalvadore 6d760a1a99 Feat/deep dark (#27026)
* chore: move to deeper dark

* tidy up boxes on www

* update deep-dark colors

* fix homepage product cards

* toned down pricing page a little

* update

* lots of color changes

* Update grid.scss

* Update EntityListItem.tsx

* Update EntityListItem.tsx

* fix partners page icon

* fix partners page colors

* update theme

* Update global.css

* combined dark theme so classic-dark does not break on other sites

* Update package-lock.json

* updated color tokens pipeline to support combined dark theme

* smol updates

* Update FeaturedThumb.tsx

* Update BlogFilters.tsx

* Update BlogListItem.tsx

* Update BlogListItem.tsx

* Update UserSettingsDropdown.tsx

* Update NavigationBar.tsx

---------

Co-authored-by: Francesco Sansalvadore <f.sansalvadore@gmail.com>
2024-07-30 21:34:28 +08:00

78 lines
2.5 KiB
TypeScript

import Image from 'next/image'
import Link from 'next/link'
import authors from 'lib/authors.json'
import PostTypes from '../../types/post'
function FeaturedThumb(blog: PostTypes) {
// @ts-ignore
const authorArray = blog.author.split(',')
const author = []
for (let i = 0; i < authorArray.length; i++) {
// @ts-ignore
author.push(
authors.find((authors: any) => {
// @ts-ignore
return authors.author_id === authorArray[i]
})
)
}
return (
<div key={blog.slug} className="w-full">
<Link
href={`${blog.path}`}
className="grid gap-4 lg:grid-cols-7 lg:gap-8 xl:gap-12 hover:bg-surface-200 dark:hover:bg-surface-75 p-2 sm:p-4 rounded-xl"
>
<div className="relative w-full aspect-[2/1] lg:col-span-3 lg:aspect-[3/2] overflow-auto rounded-lg border">
<Image
src={`/images/blog/` + (blog.thumb ? blog.thumb : blog.image)}
fill
sizes="100%"
quality={100}
className="object-cover"
alt="blog thumbnail"
/>
</div>
<div className="flex flex-col space-y-2 lg:col-span-4 xl:justify-center max-w-xl">
<div className="text-lighter flex space-x-2 text-sm">
<span>{blog.date}</span>
<span>•</span>
<span>{blog.readingTime}</span>
</div>
<div>
<h2 className="h2 lg:!text-2xl xl:!text-3xl !mb-2">{blog.title}</h2>
<p className="p xl:text-lg">{blog.description}</p>
</div>
<div className="flex flex-col w-max gap-2">
{author.map((author: any, i: number) => {
return (
<div className="flex items-center space-x-2" key={i}>
{author.author_image_url && (
<div className="relative h-6 w-6 overflow-auto">
<Image
src={author.author_image_url}
alt={`${author.author} avatar`}
className="rounded-full object-cover"
fill
sizes="30px"
/>
</div>
)}
<div className="flex flex-col">
<span className="text-foreground m-0 text-sm">{author.author}</span>
</div>
</div>
)
})}
</div>
</div>
</Link>
</div>
)
}
export default FeaturedThumb