2024-12-06 19:15:06 +00:00
|
|
|
import React, { useState } from "react";
|
|
|
|
|
import { Button } from "../ui/button";
|
2024-12-17 14:27:48 +00:00
|
|
|
import { Reveal } from "./Reveal";
|
2024-12-18 16:28:31 +00:00
|
|
|
import { Icon } from "@iconify/react/dist/iconify.js";
|
2025-01-02 02:58:01 +00:00
|
|
|
import { Link } from "@/i18n/routing";
|
2025-01-05 13:46:18 +00:00
|
|
|
import { useTranslations } from "next-intl";
|
|
|
|
|
import { usePathname } from "next/navigation";
|
2024-12-06 19:15:06 +00:00
|
|
|
|
2025-01-04 03:44:57 +00:00
|
|
|
const regions = [
|
|
|
|
|
{ name: "SIBER", slug: "siber", logo: "/assets/satker/siber.png" },
|
|
|
|
|
{ name: "DIVKUM", slug: "divkum", logo: "/assets/satker/divkum.png" },
|
|
|
|
|
{ name: "PUSKEU", slug: "puskeu", logo: "/assets/satker/puskeu.png" },
|
|
|
|
|
{ name: "SSDM", slug: "ssdm", logo: "/assets/satker/ssdm.png" },
|
|
|
|
|
{ name: "ITWASUM", slug: "itwasum", logo: "/assets/satker/itwasum.png" },
|
|
|
|
|
{ name: "STIK-PTIK", slug: "stik-ptik", logo: "/assets/satker/stik-ptik.png" },
|
|
|
|
|
{ name: "SATUAN KERJA POLRI", slug: "satuan-kerja-polri", logo: "/assets/satker/satuan-kerja-polri.png" },
|
|
|
|
|
{ name: "BRIMOB", slug: "brimob", logo: "/assets/satker/brimob.png" },
|
|
|
|
|
{ name: "DIV HUMAS", slug: "div-humas", logo: "/assets/satker/div-humas.png" },
|
|
|
|
|
{ name: "PUSLITBANG", slug: "puslitbang", logo: "/assets/satker/puslitbang.png" },
|
|
|
|
|
{ name: "BINMAS", slug: "binmas", logo: "/assets/satker/binmas.png" },
|
|
|
|
|
{ name: "DIV TIK", slug: "div-tik", logo: "/assets/satker/div-tik.png" },
|
|
|
|
|
{ name: "SPRIPIM", slug: "spripim", logo: "/assets/satker/spripim.png" },
|
|
|
|
|
{ name: "DIVPROPRAM", slug: "divpropram", logo: "/assets/satker/div-propram.png" },
|
|
|
|
|
{ name: "KORPS SABHARA BAHARKAM", slug: "korps-sabhara-baharkam", logo: "/assets/satker/khorp-sabhara-baharkam.png" },
|
|
|
|
|
{ name: "PUSDOKKES", slug: "pusdokkes", logo: "/assets/satker/pusdokkes.png" },
|
|
|
|
|
{ name: "BAHARKAM", slug: "baharkam", logo: "/assets/satker/baharkam.png" },
|
|
|
|
|
{ name: "POLAIRUD", slug: "polairud", logo: "/assets/satker/polairud.png" },
|
|
|
|
|
{ name: "POLAIR", slug: "polair", logo: "/assets/satker/polair.png" },
|
|
|
|
|
{ name: "POLUDARA", slug: "poludara", logo: "/assets/satker/poludara.png" },
|
|
|
|
|
{ name: "LEMDIKLAT", slug: "lemdiklat", logo: "/assets/satker/lemdiklat.png" },
|
|
|
|
|
{ name: "AKPOL", slug: "akpol", logo: "/assets/satker/akpol.png" },
|
|
|
|
|
{ name: "KORLANTAS", slug: "korlantas", logo: "/assets/satker/korlantas.png" },
|
|
|
|
|
{ name: "PUSINAFIS", slug: "pusinafis", logo: "/assets/satker/pusinafis.png" },
|
|
|
|
|
{ name: "PUSJARAH", slug: "pusjarah", logo: "/assets/satker/pusjarah.png" },
|
|
|
|
|
{ name: "PUSIKNAS", slug: "pusiknas", logo: "/assets/satker/pusiknas.png" },
|
|
|
|
|
{ name: "SLOG", slug: "slog", logo: "/assets/satker/slog.png" },
|
|
|
|
|
{ name: "BAINTELKAM", slug: "baintelkam", logo: "/assets/satker/baintelkam.jpg" },
|
|
|
|
|
{ name: "BARESKRIM", slug: "bareskrim", logo: "/assets/satker/bareskrim.png" },
|
|
|
|
|
{ name: "DIVHUBINTER", slug: "divhubinter", logo: "/assets/satker/divhubinter.png" },
|
|
|
|
|
{ name: "SETUM", slug: "setum", logo: "/assets/satker/setum.png" },
|
|
|
|
|
{ name: "PUSLABFOR", slug: "puslabfor", logo: "/assets/satker/puslabfor.png" },
|
|
|
|
|
{ name: "DENSUS 88", slug: "densus-88", logo: "/assets/satker/densus88.png" },
|
|
|
|
|
{ name: "SAHLI KAPOLRI", slug: "sahli-kapolri", logo: "/assets/satker/sahli-kapolri.png" },
|
|
|
|
|
{ name: "SOPS", slug: "sops", logo: "/assets/satker/sops.png" },
|
|
|
|
|
{ name: "SRENA", slug: "srena", logo: "/assets/satker/srena.png" },
|
|
|
|
|
{ name: "SESPIM POLRI", slug: "sespim-polri", logo: "/assets/satker/sespim-polri.png" },
|
|
|
|
|
{ name: "SETUPA POLRI", slug: "setupa-polri", logo: "/assets/satker/setupa-polri.png" },
|
|
|
|
|
];
|
|
|
|
|
|
2024-12-06 19:15:06 +00:00
|
|
|
const Division = () => {
|
|
|
|
|
const [searchTerm, setSearchTerm] = useState("");
|
|
|
|
|
const [seeAllValue, setSeeAllValue] = useState(false);
|
2025-01-04 03:44:57 +00:00
|
|
|
const [filteredList, setFilteredList] = useState<typeof regions | undefined>(regions);
|
2025-01-05 13:46:18 +00:00
|
|
|
const pathname = usePathname();
|
|
|
|
|
const t = useTranslations("LandingPage");
|
2025-01-04 03:44:57 +00:00
|
|
|
|
|
|
|
|
const handleSearch = () => {
|
|
|
|
|
const value = searchTerm.toLowerCase();
|
2024-12-06 19:15:06 +00:00
|
|
|
|
2025-01-04 03:44:57 +00:00
|
|
|
const filtered = regions.filter((satker) => satker.name.toLowerCase().includes(value));
|
|
|
|
|
setFilteredList(filtered);
|
|
|
|
|
};
|
2024-12-06 19:15:06 +00:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="max-w-screen-xl mx-auto px-4 lg:px-12 py-6">
|
|
|
|
|
{/* Header */}
|
2024-12-17 14:27:48 +00:00
|
|
|
<Reveal>
|
|
|
|
|
<h2 className="text-center text-2xl font-bold text-gray-800 dark:text-white mb-4">
|
2025-01-05 13:46:18 +00:00
|
|
|
{pathname?.split("/")[1] == "in" ? (
|
|
|
|
|
<>
|
|
|
|
|
{t("coverageOnly")} <span className="text-[#bb3523]">{t("division")}</span>{" "}
|
|
|
|
|
</>
|
|
|
|
|
) : (
|
|
|
|
|
<>
|
|
|
|
|
{t("division")}
|
|
|
|
|
<span className="text-[#bb3523]">{t("coverageOnly")}</span>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
2024-12-17 14:27:48 +00:00
|
|
|
</h2>
|
|
|
|
|
<div className="h-1 w-48 bg-[#bb3523] mx-auto mb-6 rounded"></div>
|
2024-12-06 19:15:06 +00:00
|
|
|
|
2024-12-17 14:27:48 +00:00
|
|
|
{/* Pencarian */}
|
|
|
|
|
<div className="flex items-center justify-center gap-4 mb-6">
|
2025-01-05 13:46:18 +00:00
|
|
|
<input onChange={(e) => setSearchTerm(e.target.value)} type="text" placeholder={t("search")} className="w-4/5 px-4 py-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-[#bb3523] focus:outline-none" />
|
2025-01-04 03:44:57 +00:00
|
|
|
<button onClick={handleSearch} className="px-2 w-1/5 lg:px-4 py-2 bg-[#bb3523] text-xs lg:text-base flex justify-center items-center gap-2 text-white rounded-md hover:bg-red-700">
|
2025-01-05 13:46:18 +00:00
|
|
|
{t("searchDivision")}
|
|
|
|
|
<Icon icon="ri:arrow-right-s-line" fontSize={20} />
|
2024-12-18 16:28:31 +00:00
|
|
|
</button>
|
2024-12-17 14:27:48 +00:00
|
|
|
</div>
|
2024-12-06 19:15:06 +00:00
|
|
|
|
2024-12-17 14:27:48 +00:00
|
|
|
{/* Grid Wilayah */}
|
|
|
|
|
<div className="grid grid-cols-3 md:grid-cols-4 lg:grid-cols-7 gap-6">
|
2025-01-04 03:44:57 +00:00
|
|
|
{filteredList && filteredList.length > 0 ? (
|
|
|
|
|
filteredList.map((region, index) =>
|
|
|
|
|
!seeAllValue ? (
|
|
|
|
|
index < 7 ? (
|
2025-01-07 16:53:22 +00:00
|
|
|
<Link href={`/satker/${region.slug}`} key={index} className="flex flex-col items-center text-center group">
|
2025-01-04 03:44:57 +00:00
|
|
|
<div className="relative w-20 h-20 rounded-full border-2 border-[#bb3523] overflow-hidden mb-2 flex items-center justify-center">
|
|
|
|
|
<img src={region.logo} alt={region.name} className="w-3/4 h-3/4 object-contain group-hover:scale-110 transition-transform duration-300" />
|
|
|
|
|
</div>
|
|
|
|
|
<p className="text-md font-semibold">{region.name}</p>
|
|
|
|
|
</Link>
|
|
|
|
|
) : (
|
|
|
|
|
""
|
|
|
|
|
)
|
|
|
|
|
) : (
|
2025-01-07 16:53:22 +00:00
|
|
|
<Link href={`/satker/${region.slug}`} key={index} className="flex flex-col items-center text-center group">
|
2024-12-17 14:27:48 +00:00
|
|
|
<div className="relative w-20 h-20 rounded-full border-2 border-[#bb3523] overflow-hidden mb-2 flex items-center justify-center">
|
|
|
|
|
<img src={region.logo} alt={region.name} className="w-3/4 h-3/4 object-contain group-hover:scale-110 transition-transform duration-300" />
|
|
|
|
|
</div>
|
|
|
|
|
<p className="text-md font-semibold">{region.name}</p>
|
2025-01-02 02:58:01 +00:00
|
|
|
</Link>
|
2024-12-17 14:27:48 +00:00
|
|
|
)
|
2024-12-06 19:15:06 +00:00
|
|
|
)
|
2025-01-04 03:44:57 +00:00
|
|
|
) : (
|
|
|
|
|
<p className="items-center text-center text-[#bb3523] text-lg font-semibold">Satker Tidak Ditemukan</p>
|
2024-12-17 14:27:48 +00:00
|
|
|
)}
|
|
|
|
|
</div>
|
2025-01-04 03:44:57 +00:00
|
|
|
{filteredList && filteredList.length > 9 && (
|
|
|
|
|
<div className="flex justify-center py-5">
|
|
|
|
|
<Button onClick={() => setSeeAllValue(!seeAllValue)} className="bg-white hover:bg-[#bb3523] text-[#bb3523] hover:text-white border-2 border-[#bb3523]">
|
2025-01-05 13:46:18 +00:00
|
|
|
{seeAllValue ? t("seeLess") : t("seeMore")}
|
2025-01-04 03:44:57 +00:00
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2024-12-18 16:28:31 +00:00
|
|
|
</Reveal>
|
2024-12-06 19:15:06 +00:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default Division;
|