generated from mateusfg7/nextjs-setup
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { allTILs, TIL } from 'contentlayer/generated' | ||
import { useMDXComponent } from 'next-contentlayer/hooks' | ||
|
||
import { Title } from '@/shared/components/title' | ||
import { Date } from '@/shared/components/date' | ||
|
||
import 'katex/dist/katex.min.css' | ||
|
||
const TILComponent = ({ til }: { til: TIL }) => { | ||
const MDXContent = useMDXComponent(til.body.code) | ||
return ( | ||
<div className="relative flex flex-col gap-6 border-b border-b-neutral-200 py-12 last:border-none dark:border-b-neutral-800 md:flex-row md:gap-1"> | ||
<div className="top-24 h-fit w-full space-y-2 md:sticky md:space-y-5"> | ||
<div className="space-y-3"> | ||
<h2 className="text-xl font-bold">{til.title}</h2> | ||
<p>{til.description}</p> | ||
<span className="text-sm"> | ||
<Date dateString={til.date} /> | ||
</span> | ||
</div> | ||
<div className="flex flex-wrap gap-1"> | ||
{til.tags.map(tag => ( | ||
<span | ||
className="rounded-lg bg-neutral-400/10 p-1 text-sm leading-none" | ||
key={tag} | ||
> | ||
{tag} | ||
</span> | ||
))} | ||
</div> | ||
</div> | ||
<div className="post-content til-content md:w-2/3"> | ||
<MDXContent /> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default function Page() { | ||
return ( | ||
<div className="content-container m-auto space-y-4"> | ||
<Title text="Today I Learned" /> | ||
<div className="flex flex-col gap-3"> | ||
{allTILs.map(til => ( | ||
<TILComponent til={til} key={til.date} /> | ||
))} | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters