Skip to content

Commit

Permalink
feat(components): use @/* import path on PostLink component
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusfg7 committed May 29, 2023
1 parent f95d59e commit 00b2818
Showing 1 changed file with 25 additions and 17 deletions.
42 changes: 25 additions & 17 deletions src/components/PostLink.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react'
import Link from 'next/link'

import { Date } from './Date'
import { Date } from '@/components/Date'
import { Post } from 'contentlayer/generated'
import { DraftBadge, PlannedBadge, TestBadge } from './PostBadges'
import { DraftBadge, PlannedBadge, TestBadge } from '@/components/PostBadges'

interface Props {
post: Post
Expand All @@ -14,49 +14,57 @@ export function PostLink({ post, hideYear = false }: Props) {
const showDate = !post.test && post.status !== 'planned'

if (post.status === 'planned') {

return (
<section className="space-y-2 group cursor-pointer">
<div className='flex items-center justify-start gap-2'>
<section className="group cursor-pointer space-y-2">
<div className="flex items-center justify-start gap-2">
<h2 className="text-xl font-bold text-neutral-700 dark:text-neutral-500">
{post.title}
</h2>
<span className='group-hover:animate-wiggle group-hover:animate-infinite'>
<span className="group-hover:animate-wiggle group-hover:animate-infinite">
<PlannedBadge />
</span>
</div>
<span className="text-neutral-500">
{
showDate && (<span><Date dateString={post.date} dateFormat={hideYear ? 'LLL d' : 'LLL d, yyyy'} /> &#8226; </span>)
}
{showDate && (
<span>
<Date
dateString={post.date}
dateFormat={hideYear ? 'LLL d' : 'LLL d, yyyy'}
/>{' '}
&#8226;{' '}
</span>
)}

{post.description}
</span>
</section>
)
}
else {

} else {
return (
<Link href={`/post/${post.id}`} className="group">
<section className="space-y-2">
<div className='flex items-center justify-start gap-2'>
<div className="flex items-center justify-start gap-2">
<h2 className="text-xl font-bold text-neutral-700 group-hover:text-blue-700 dark:text-neutral-500 dark:group-hover:text-blue-500">
{post.title}
</h2>
{post.test && <TestBadge />}
{post.status === 'draft' && !post.test && <DraftBadge />}
</div>
<span className="text-neutral-500 group-hover:text-neutral-700 dark:group-hover:text-neutral-400">
{
showDate && (<span><Date dateString={post.date} dateFormat={hideYear ? 'LLL d' : 'LLL d, yyyy'} /> &#8226; </span>)
}
{showDate && (
<span>
<Date
dateString={post.date}
dateFormat={hideYear ? 'LLL d' : 'LLL d, yyyy'}
/>{' '}
&#8226;{' '}
</span>
)}

{post.description}
</span>
</section>
</Link>
)
}

}

0 comments on commit 00b2818

Please sign in to comment.