Skip to content

Commit

Permalink
Update blog create date
Browse files Browse the repository at this point in the history
  • Loading branch information
ALPHAAAL committed Apr 6, 2024
1 parent 896ffbd commit 63c9126
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/assets/markdown.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"name": "react_caveats",
"description": "Some caveats on react useCallback / useMemo hook and re-renders",
"tags": ["react"],
"readingTime": 5
"readingTime": 5,
"createAt": "2024-04-01T13:54:55.951Z"
}
]
7 changes: 4 additions & 3 deletions src/components/Blog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@ type BlogPostRowType = {
description: string;
tags: string[];
readingTime: number;
createAt: Date;
}

function BlogPostRow(props: BlogPostRowType) {
const { title, description, tags, readingTime } = props;
const { title, description, tags, readingTime, createAt } = props;
const navigate = useNavigate();

return (
<div className="grid sm:grid-cols-5 my-3">
<div className="flex flex-col sm:p-3">
<p>Today</p>
<p>{`${createAt.toLocaleDateString()}`}</p>
<div className="hidden mt-3 w-[100px] h-[100px] bg-cyan-400 sm:block"></div>
</div>
<div onClick={() => navigate('react_caveats')} className="sm:col-start-2 sm:col-span-3 flex flex-col sm:p-3 [&>*]:mb-2 hover:bg-slate-400/5 cursor-pointer">
Expand All @@ -53,7 +54,7 @@ export default function Blog() {
<p>Blog page under construction :P</p>
<h1 className='mt-3 text-4xl'>My thoughts on programming, books, and fun things in life</h1>
<div className="mt-16 sm:border-l-[0.5px] sm:border-l-slate-700 sm:pl-4 sm:mt-20">
{MD_JSON.map((data) => <BlogPostRow key={data.name} title={data.name} description={data.description} readingTime={data.readingTime} tags={data.tags} />)}
{MD_JSON.map((data) => <BlogPostRow key={data.name} createAt={new Date(data.createAt)} title={data.name} description={data.description} readingTime={data.readingTime} tags={data.tags} />)}
</div>
</div>
)
Expand Down

0 comments on commit 63c9126

Please sign in to comment.