2025-02-01 06:57:24 +07:00
|
|
|
import React from "react";
|
|
|
|
import Image from "next/image";
|
|
|
|
import Link from "next/link";
|
2025-02-12 01:14:56 +07:00
|
|
|
import { fetchBlog } from "@/services/payload/blog";
|
|
|
|
import { sanitizeBlogContentIntoStringPreview } from "@/utils/sanitize";
|
2025-02-05 22:17:43 +07:00
|
|
|
|
2025-02-12 01:14:56 +07:00
|
|
|
export default async function Blog() {
|
|
|
|
const data = await fetchBlog(undefined);
|
|
|
|
|
|
|
|
if (!data?.totalDocs) return <></>;
|
2025-02-01 06:57:24 +07:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
{/* End Background Shape */}
|
|
|
|
<div className="container position-relative">
|
|
|
|
<div className="row mb-60 mb-sm-40">
|
|
|
|
<div className="col-lg-8 offset-lg-2 text-center mb-md-30">
|
|
|
|
<h2 className="section-caption-slick mb-30 mb-sm-20">Our Blog</h2>
|
2025-02-05 22:17:43 +07:00
|
|
|
<h3 className="section-title mb-30">Check the latest news about our company in our blog.</h3>
|
2025-02-01 06:57:24 +07:00
|
|
|
<p className="section-descr mb-0">
|
2025-02-05 22:17:43 +07:00
|
|
|
There are three kinds of web developer specialization front-end developer, back-end developer, and
|
|
|
|
full-stack developer.
|
2025-02-01 06:57:24 +07:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<div className="col-lg-2 d-flex align-items-end">
|
|
|
|
<div className="local-scroll text-center text-lg-end w-100">
|
2025-02-05 22:17:43 +07:00
|
|
|
<Link href={`/slick-blog-dark`} className="link-hover-anim" data-link-animate="y">
|
2025-02-01 06:57:24 +07:00
|
|
|
<span className="link-strong link-strong-unhovered">
|
2025-02-05 22:17:43 +07:00
|
|
|
Our blog <i className="mi-arrow-right size-24" aria-hidden="true"></i>
|
2025-02-01 06:57:24 +07:00
|
|
|
</span>
|
2025-02-05 22:17:43 +07:00
|
|
|
<span className="link-strong link-strong-hovered" aria-hidden="true">
|
|
|
|
Our blog <i className="mi-arrow-right size-24" aria-hidden="true"></i>
|
2025-02-01 06:57:24 +07:00
|
|
|
</span>
|
|
|
|
</Link>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{/* Blog Posts Grid */}
|
|
|
|
<div className="row mt-n30">
|
|
|
|
{/* Post Item */}
|
2025-02-12 01:14:56 +07:00
|
|
|
{data?.formattedData?.slice(0, 2).map((elm: any, i: number) => (
|
2025-02-05 22:17:43 +07:00
|
|
|
<div key={i} className="post-prev-3 col-12 col-lg-10 offset-lg-1 col-xl-6 offset-xl-0 mt-30">
|
2025-02-01 06:57:24 +07:00
|
|
|
<div className="post-prev-3-container d-block d-sm-flex">
|
|
|
|
<div className="post-prev-3-img">
|
2025-02-12 01:14:56 +07:00
|
|
|
<Link href={elm.slug}>
|
2025-02-01 06:57:24 +07:00
|
|
|
<Image
|
2025-02-12 01:14:56 +07:00
|
|
|
src={elm.imgFormatted.url}
|
2025-02-01 06:57:24 +07:00
|
|
|
width={400}
|
2025-02-12 01:14:56 +07:00
|
|
|
height={200}
|
2025-02-01 06:57:24 +07:00
|
|
|
alt="Add Image Description"
|
|
|
|
className="wow scaleOutIn"
|
|
|
|
/>
|
|
|
|
</Link>
|
|
|
|
</div>
|
|
|
|
<div className="post-prev-3-intro">
|
|
|
|
<h4 className="post-prev-3-title">
|
2025-02-12 01:14:56 +07:00
|
|
|
<Link href={elm.slug}>{elm.title}</Link>
|
2025-02-01 06:57:24 +07:00
|
|
|
</h4>
|
2025-02-12 01:14:56 +07:00
|
|
|
<div className="post-prev-3-text">{sanitizeBlogContentIntoStringPreview(elm.content)}</div>
|
2025-02-01 06:57:24 +07:00
|
|
|
<div className="post-prev-3-info clearfix">
|
|
|
|
<div className="float-end">
|
2025-02-12 01:14:56 +07:00
|
|
|
<a href="#">{elm.createdAtFormatted}</a>
|
2025-02-01 06:57:24 +07:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
))}
|
|
|
|
{/* End Post Item */}
|
|
|
|
</div>
|
|
|
|
{/* End Blog Posts Grid */}
|
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|