refactor: code refactor

This commit is contained in:
Andrea
2024-02-05 19:03:39 +01:00
parent 2e879d9c00
commit fa60885d85
7 changed files with 38 additions and 14 deletions

View File

@@ -1,7 +1,7 @@
export function EmptyState() {
return (
<div className="mt-5 mx-5 flex flex-col items-center">
<div className="mb-5 font-bold">
<div className="mx-5 flex flex-col items-center">
<div className="font-bold">
I haven't post anything yet! So here's a pic of my cat
</div>
<img src="/cat.jpg" className="rounded-md" />

View File

@@ -11,8 +11,8 @@ type PostProps = {
export function Post({ title, description, filename, published }: PostProps) {
return (
<BlogWrapper>
<div className="p-5 text-center font-bold border-gray-600 border-2 rounded-lg">
<Link to={filename}>
<Link to={filename}>
<div className="p-5 text-center font-bold border-gray-600 border-2 rounded-lg">
<span className="text-[#ffff00] hover:text-[#e6c2bf] text-2xl">
{title}
</span>
@@ -20,8 +20,8 @@ export function Post({ title, description, filename, published }: PostProps) {
published,
).toLocaleDateString()})`}</span>
{description && <div className="mt-5 text-xl">{description}</div>}
</Link>
</div>
</div>
</Link>
</BlogWrapper>
);
}

View File

@@ -16,13 +16,13 @@ export const loader = () => {
export default function () {
const posts = useLoaderData<typeof loader>();
return (
<>
<div className="space-y-5">
<Title>Here I blog about whatever get my attention</Title>
{posts.length > 0 ? (
posts.map((post, i) => <Post {...post} key={i} />)
) : (
<EmptyState />
)}
</>
</div>
);
}