qudoco-fe/components/landing-page/about.tsx

110 lines
3.9 KiB
TypeScript
Raw Normal View History

"use client";
2026-02-17 09:05:22 +00:00
import Image from "next/image";
import { motion } from "framer-motion";
2026-04-10 07:21:29 +00:00
import type { CmsAboutContent } from "@/types/cms-landing";
2026-02-17 09:05:22 +00:00
2026-04-10 07:21:29 +00:00
const DEFAULT_KICKER = "About Us";
const DEFAULT_HEADLINE = "Helping you find the right Solution";
const DEFAULT_DESC =
"PT Qudo Buana Nawakara adalah perusahaan nasional Indonesia yang berfokus pada pengembangan aplikasi...";
export default function AboutSection({
about,
}: {
about?: CmsAboutContent | null;
}) {
const kicker = about?.secondary_title?.trim() || DEFAULT_KICKER;
const headline = about?.primary_title?.trim() || DEFAULT_HEADLINE;
const desc = about?.description?.trim() || DEFAULT_DESC;
const media = about?.images?.[0];
const mediaUrl = media?.media_url?.trim();
const isVideo =
media?.media_type?.startsWith("video") ||
/\.(mp4|webm)(\?|$)/i.test(mediaUrl ?? "") ||
(mediaUrl?.toLowerCase().includes("video") ?? false);
2026-02-17 09:05:22 +00:00
const messages = [
{ id: 1, text: "Dimana posisi Ayah saya sekarang?", type: "user" },
{
id: 2,
text: "Bapak Ahmad terdeteksi di Tenda Maktab 45, Mina.",
type: "bot",
},
{ id: 3, text: "Apakah ada berita cuaca hari ini?", type: "user" },
{
id: 4,
text: "Makkah saat ini cerah, suhu 38°. Kemenag menghimbau jamaah untuk minum air tiap 1 jam.",
type: "bot",
},
];
2026-02-17 09:05:22 +00:00
return (
<section className="relative bg-[#f7f0e3] py-24">
<div className="container mx-auto grid grid-cols-1 items-center gap-16 px-6 md:grid-cols-2">
<div className="flex justify-center">
2026-04-10 07:21:29 +00:00
<div className="relative h-[640px] w-[320px]">
<Image
src="/image/phone.png"
alt="App Preview"
fill
2026-04-10 07:21:29 +00:00
className="pointer-events-none z-10 object-contain"
/>
2026-04-10 07:21:29 +00:00
<div className="absolute bottom-[120px] left-[25px] right-[25px] top-[120px] z-0 overflow-hidden rounded-[2rem] bg-black/5">
{mediaUrl && isVideo ? (
// eslint-disable-next-line jsx-a11y/media-has-caption
<video
src={mediaUrl}
className="h-full w-full object-cover"
autoPlay
muted
loop
playsInline
/>
) : mediaUrl ? (
// eslint-disable-next-line @next/next/no-img-element
<img src={mediaUrl} alt="" className="h-full w-full object-cover" />
) : (
<div className="flex flex-col gap-4 p-2">
{messages.map((msg, index) => (
<motion.div
key={msg.id}
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: index * 1.2 }}
className={`max-w-[80%] rounded-2xl px-4 py-3 text-sm shadow ${
msg.type === "user"
? "self-end rounded-br-sm bg-blue-600 text-white"
: "self-start rounded-bl-sm bg-gray-200 text-gray-800"
}`}
>
{msg.text}
</motion.div>
))}
</div>
)}
</div>
</div>
2026-02-17 09:05:22 +00:00
</div>
<div className="max-w-xl">
<p className="mb-4 text-sm font-semibold uppercase tracking-widest text-gray-400">
2026-04-10 07:21:29 +00:00
{kicker}
2026-02-17 09:05:22 +00:00
</p>
2026-04-10 07:21:29 +00:00
<h2 className="mb-6 text-4xl font-extrabold leading-tight whitespace-pre-line">
2026-02-17 09:05:22 +00:00
<span className="relative inline-block">
<span className="absolute bottom-1 left-0 h-3 w-full bg-[#966314]/40"></span>
2026-04-10 07:21:29 +00:00
<span className="relative">{headline}</span>
2026-02-17 09:05:22 +00:00
</span>
</h2>
2026-04-10 07:21:29 +00:00
<p className="text-sm leading-relaxed text-gray-600 whitespace-pre-line">{desc}</p>
2026-02-17 09:05:22 +00:00
</div>
</div>
</section>
);
}