Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
halituzan committed Sep 3, 2024
1 parent 33cb0bd commit d06843f
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 76 deletions.
152 changes: 77 additions & 75 deletions app/Components/Main/Pages/Blog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,90 +14,92 @@ type Props = {
};

const Blog = ({ data, title, isTagPage }: Props) => {
console.log("data", data);

const router = useRouter();
const { tag } = router.query;

return (
// <Suspense fallback={<Loading />}>
<section className='w-full p-5 h-[calc(100vh-107px)] overflow-auto'>
<h1 className='text-3xl font-semibold w-full pb-1'>{title}</h1>
{isTagPage && (
<div>
<Link
href={"/blogs"}
className='flex items-center cursor-pointer w-[100px] mb-5'
>
<Icon
icon='solar:map-arrow-left-bold-duotone'
className='text-orange-500'
fontSize={28}
/>
<span className='text-lg font-bod ml-1 font-bold hover:text-orange-600 hover:underline '>
Tümü
</span>
</Link>
<Suspense fallback={<Loading />}>
<section className='w-full p-5 h-[calc(100vh-107px)] overflow-auto'>
<h1 className='text-3xl font-semibold w-full pb-1'>{title}</h1>
{isTagPage && (
<div>
<span className='font-bold'>{tag}</span> etiketi ile{" "}
<span className='font-bold'>({data.length})</span> adet içerik
bulundu
<Link
href={"/blogs"}
className='flex items-center cursor-pointer w-[100px] mb-5'
>
<Icon
icon='solar:map-arrow-left-bold-duotone'
className='text-orange-500'
fontSize={28}
/>
<span className='text-lg font-bod ml-1 font-bold hover:text-orange-600 hover:underline '>
Tümü
</span>
</Link>
<div>
<span className='font-bold'>{tag}</span> etiketi ile{" "}
<span className='font-bold'>({data.length})</span> adet içerik
bulundu
</div>
</div>
</div>
)}
)}

{data.map((item) => {
return (
<article key={item._id} className='my-6'>
<Link href={`/blogs/${item.url + "-" + item.code}`}>
<h3
className={`text-xl mb-1 cursor-pointer font-bold text-orange-500 hover:text-orange-600`}
>
{item.title}
</h3>
</Link>
<div className='flex items-center border-y py-1 border-y-slate-400'>
<div className='flex justify-start items-center mr-4'>
<Icon
icon={"fluent:calendar-ltr-12-regular"}
className='mr-2'
/>
<p className='italic text-sm' role='date'>
{moment(item.releaseDate).format("MMMM DD [,] YYYY")}
</p>
{data.map((item) => {
return (
<article key={item._id} className='my-6'>
<Link href={`/blogs/${item.url + "-" + item.code}`}>
<h3
className={`text-xl mb-1 cursor-pointer font-bold text-orange-500 hover:text-orange-600`}
>
{item.title}
</h3>
</Link>
<div className='flex items-center border-y py-1 border-y-slate-400'>
<div className='flex justify-start items-center mr-4'>
<Icon
icon={"fluent:calendar-ltr-12-regular"}
className='mr-2'
/>
<p className='italic text-sm' role='date'>
{moment(item.releaseDate).format("MMMM DD [,] YYYY")}
</p>
</div>
<div className='flex justify-start items-center mr-4'>
<Icon icon={"fluent:pen-16-regular"} className='mr-2' />
<p className='italic text-sm' role='author'>
{item.author}
</p>
</div>
<div className='flex justify-start items-center mr-2'>
<p className='text-sm flex items-center' role='author'>
{item.tags.map((i: TagProps) => {
return (
<Link
href={"/tags/" + i.url}
key={i._id}
className='mr-1 font-semibold cursor-pointer text-sm hover:underline hover:text-orange-500 flex items-center'
>
<Icon
icon={"line-md:hash-small"}
className='text-orange-500'
/>
{i.name}
</Link>
);
})}
</p>
</div>
</div>
<div className='flex justify-start items-center mr-4'>
<Icon icon={"fluent:pen-16-regular"} className='mr-2' />
<p className='italic text-sm' role='author'>
{item.author}
</p>
<div className='mt-2 text-sm font-medium'>
<p>{item.summary}</p>
</div>
<div className='flex justify-start items-center mr-2'>
<p className='text-sm flex items-center' role='author'>
{item.tags.map((i: TagProps) => {
return (
<Link
href={"/tags/" + i.url}
key={i._id}
className='mr-1 font-semibold cursor-pointer text-sm hover:underline hover:text-orange-500 flex items-center'
>
<Icon
icon={"line-md:hash-small"}
className='text-orange-500'
/>
{i.name}
</Link>
);
})}
</p>
</div>
</div>
<div className='mt-2 text-sm font-medium'>
<p>{item.summary}</p>
</div>
</article>
);
})}
</section>
//</Suspense>
</article>
);
})}
</section>
</Suspense>
);
};

Expand Down
1 change: 0 additions & 1 deletion pages/api/blogs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ connectDBV2();
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
try {
const blogs = await Blogs.find({});
console.log("blogs", blogs);
return res.status(200).json({
data: blogs,
status: true,
Expand Down

0 comments on commit d06843f

Please sign in to comment.