
Co-authored-by: Juan Manzanero <59628111+juancmandev@users.noreply.github.com> Reviewed-on: https://git.juancman.dev/juancmandev/website/pulls/1 Co-authored-by: juancmandev <juancmandev@protonmail.com> Co-committed-by: juancmandev <juancmandev@protonmail.com>
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import formatDate from '@/utils/format-date';
|
|
import { Button } from '@/components/ui/button';
|
|
|
|
type Props = {
|
|
id: string;
|
|
date: Date | string;
|
|
title: string;
|
|
type: 'blog' | 'portfolio' | 'videos';
|
|
lang: string;
|
|
};
|
|
|
|
export default function PostItem(props: Props) {
|
|
return (
|
|
<Button
|
|
asChild
|
|
size={null}
|
|
variant='link'
|
|
className='group hover:no-underline focus:no-underline text-foreground visited:text-purple-600 px-4 whitespace-normal py-2 flex flex-col items-start italic border border-secondary hover:border-foreground focus:border-foreground transition-colors rounded-md'
|
|
>
|
|
<a
|
|
className='no-underline'
|
|
href={
|
|
props.lang === 'en'
|
|
? `/${props.type}/${props.id}`
|
|
: `/es/${props.type}/${[props.id]}`
|
|
}
|
|
>
|
|
<span className='text-foreground text-sm font-light no-underline'>
|
|
{formatDate(props.date, props.lang)}
|
|
</span>
|
|
<span className='text-lg font-semibold group-hover:underline group-focus:underline'>
|
|
{props.title}
|
|
</span>
|
|
</a>
|
|
</Button>
|
|
);
|
|
}
|