Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/blog page #50

Merged
merged 15 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions apps/next/src/components/Blog/Card/Card.constant.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export interface BlogCardProperties {
omerozceylan marked this conversation as resolved.
Show resolved Hide resolved
id: number;
blogType?: string;
title?: string;
info?: string;
userName?: string;
date?: string;
readTime?: string;
}
40 changes: 40 additions & 0 deletions apps/next/src/components/Blog/Card/Card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { type BlogCardProperties } from "./Card.constant";

export default function BlogCard({
blogType,
title,
info,
userName,
date,
readTime,
}: BlogCardProperties) {
return (
<div>
<div className=" text-[#101828]">
omerozceylan marked this conversation as resolved.
Show resolved Hide resolved
<div className="flex flex-col gap-2 px-4 pt-2 pb-5 bg-white border cursor-pointer hover:bg-slate-100 rounded-xl">
<div className="pt-2 pb-2">
<div className="bg-black h-[290px] rounded-lg"></div>
omerozceylan marked this conversation as resolved.
Show resolved Hide resolved
</div>
{blogType && (
<span className="py-1 w-fit flex items-center px-2 rounded-[0.625rem] text-xs font-medium border justify-center">
{blogType}
</span>
)}
<div className="font-bold text-xl">{title}</div>
<div className="text-gray-700 h-[72px] overflow-hidden text-ellipsis ">
omerozceylan marked this conversation as resolved.
Show resolved Hide resolved
{info}
</div>
<div className="flex items-center gap-3 pt-2">
<div className="bg-black w-[40px] h-[40px] rounded-full"></div>
omerozceylan marked this conversation as resolved.
Show resolved Hide resolved
<div>
<div>{userName}</div>
<div className="text-sm">
{date} · {readTime} read
</div>
</div>
</div>
</div>
</div>
</div>
);
}
72 changes: 72 additions & 0 deletions apps/next/src/pages/blog/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import BlogCard from "@/components/Blog/Card/Card";
import MainLayout from "@/components/Layout/MainLayout";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";

const dummyData = [
{
id: 1,
title: "Our first office",
readTime: "16 min",
info: "Over the past year, Volosoft has undergone many changes! After months of preparation and some hard work, we moved to our new office.",
blogType: "Article",
userName: "Jese Leos",
date: "Aug 15, 2021",
},
{
id: 2,
title: "Our first office",
readTime: "16 min",
info: "Over the past year, Volosoft has undergone many changes! After months of preparation and some hard work, we moved to our new office.",
blogType: "Article",
userName: "Jese Leos",
date: "Aug 15, 2021",
},
{
id: 3,
title: "Our first office",
readTime: "16 min",
info: "Over the past year, Volosoft has undergone many changes! After months of preparation and some hard work, we moved to our new office.Over the past year, Volosoft has undergone many changes! After months of preparation and some hard work, we moved to our new office.",
blogType: "Article",
userName: "Jese Leos",
date: "Aug 15, 2021",
},
{
id: 4,
title: "Our first office",
readTime: "16 min",
info: "Over the past year, Volosoft has undergone many changes! After months of preparation and some hard work, we moved to our new office.",
blogType: "Article",
userName: "Jese Leos",
date: "Aug 15, 2021",
},
];

export default function Blog() {
return (
<MainLayout>
<div className="flex justify-center">
<div className="px-4 gap-4 grid grid-cols-6 w-[1200px]">
omerozceylan marked this conversation as resolved.
Show resolved Hide resolved
<div className="text-3xl font-bold col-span-6 pt-7 flex justify-center mb-10">
Wordigo Blog
</div>
{dummyData.map((blog) => {
return (
<div
key={blog.id}
className="col-span-6 md:col-span-3 lg:col-span-2"
>
<BlogCard {...blog} />
</div>
);
})}
</div>
</div>
</MainLayout>
);
}

export async function getStaticProps({ locale }: { locale: string }) {
return {
props: { ...(await serverSideTranslations(locale, ["common", "zod"])) },
};
}
Loading