import{r as n,j as e,H as S,L as T}from"./app-2gKhTNh_.js";import{L as $}from"./LandingLayout-7uh-oYye.js";import{F as l,D as E,o as B,A as P,ab as f,ac as L}from"./index-DQiLWVLj.js";import{m as r}from"./proxy-N6hiut4S.js";import{A as M}from"./index-Kp1IKsWc.js";import"./index-C1sFUKMq.js";const u=6;function W({campus:d,news:s}){const o=d?.theme||{primary:"bg-indigo-600",textColor:"text-indigo-600",gradientFrom:"from-indigo-600",gradientTo:"to-purple-800"},b=d?.slug||"default-slug",i=n.useMemo(()=>s?Array.isArray(s.data)?s.data:Array.isArray(s)?s:[]:[],[s]),j=n.useMemo(()=>{const t=new Set;return i.forEach(a=>{a.category&&t.add(a.category)}),["Semua",...Array.from(t)]},[i]),[c,N]=n.useState("Semua"),[p,w]=n.useState(1),m=n.useMemo(()=>c==="Semua"?i:i.filter(t=>t.category===c),[i,c]),v=Math.ceil(m.length/u),k=n.useMemo(()=>{const t=(p-1)*u,a=t+u;return m.slice(t,a)},[m,p]),C=t=>{N(t),w(1)},A={backgroundImage:"radial-gradient(circle at 1px 1px, #e2e8f0 0.5px, transparent 0)",backgroundSize:"20px 20px"},x=d||{name:"Universitas",whatsappNumber:"6281234567890"},g=`Arsip Berita - ${x.name}`;return e.jsxs($,{campus:d,title:g,children:[e.jsx(S,{title:g}),e.jsxs("header",{className:`relative py-24 sm:py-32 bg-gradient-to-r ${o.gradientFrom} ${o.gradientTo} overflow-hidden`,children:[e.jsx("div",{className:"absolute inset-0 opacity-10 mix-blend-overlay"}),e.jsxs("div",{className:"relative max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 text-center",children:[e.jsx(r.h1,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},transition:{duration:.5},className:"text-4xl sm:text-6xl font-extrabold text-white tracking-tight drop-shadow-lg",children:"Arsip Berita & Pengumuman"}),e.jsxs(r.p,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.2},className:"mt-4 text-xl text-gray-200 max-w-3xl mx-auto drop-shadow-md",children:["Temukan semua informasi, perkembangan, dan pencapaian terbaru dari ",x.name,"."]})]})]}),e.jsx("div",{className:"relative py-16 sm:py-24",style:A,children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[e.jsx(r.div,{initial:{opacity:0},whileInView:{opacity:1},viewport:{once:!0},transition:{duration:.5,delay:.2},className:"mb-12 flex justify-center flex-wrap gap-3",children:j.map(t=>e.jsx("button",{onClick:()=>C(t),className:`px-5 py-2 text-sm font-semibold rounded-full transition-all duration-300 transform hover:scale-105
                                    ${c===t?`${o.primary} text-white shadow-lg`:"bg-white text-slate-700 shadow-md hover:bg-slate-100"}`,children:t},t))}),e.jsx(r.div,{layout:!0,id:"news-grid",className:"mt-12 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:e.jsx(M,{children:k.map(t=>{const a=t.color||"#4B5563",F=route("campus.berita.detail",{slug:b,id:t.id});return e.jsx(r.article,{layout:!0,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{type:"spring",stiffness:200,damping:25},className:"bg-white rounded-xl shadow-xl overflow-hidden group transform transition-all duration-300 hover:scale-[1.02] border-t-4 hover:shadow-2xl",style:{borderTopColor:a},children:e.jsxs(T,{href:F,className:"block h-full",children:[e.jsx("div",{className:"aspect-video overflow-hidden",children:e.jsx("img",{src:t.imageUrl,alt:t.title,className:"w-full h-full object-cover transition-transform duration-500 group-hover:scale-105",onError:h=>{h.target.onerror=null,h.target.src=`https://placehold.co/800x400/${a.substring(1)}/FFFFFF?text=NEWS+${t.id}`}})}),e.jsxs("div",{className:"p-6 flex flex-col justify-between h-auto",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-4 mb-3 text-sm text-gray-500",children:[e.jsxs("span",{className:"inline-block font-semibold px-3 py-1 rounded-full text-xs text-white border",style:{backgroundColor:a,borderColor:a},children:[e.jsx(l,{icon:E,className:"w-3 h-3 mr-1 inline-block"})," ",t.category]}),e.jsxs("span",{className:"flex items-center",children:[e.jsx(l,{icon:B,className:"w-3 h-3 mr-1 text-gray-400 inline-block"})," ",t.date]})]}),e.jsx("h2",{className:"text-xl font-bold text-gray-900 leading-snug transition-colors duration-200 group-hover:text-opacity-80",children:t.title}),e.jsx("p",{className:"mt-3 text-gray-600 text-sm line-clamp-3",children:t.excerpt})]}),e.jsx("div",{className:"pt-4 mt-4 border-t border-gray-100",children:e.jsxs("span",{className:"inline-flex items-center font-bold text-sm transition duration-200",style:{color:a},children:["Baca Selengkapnya",e.jsx(l,{icon:P,className:"w-3 h-3 ml-2 transform group-hover:translate-x-1 transition-transform duration-200 inline-block"})]})})]})]})},t.id)})})}),i.length===0&&e.jsxs(r.div,{initial:{opacity:0},animate:{opacity:1},className:"flex flex-col items-center justify-center text-center py-12 text-gray-500 bg-white rounded-xl shadow-lg mt-12",children:[e.jsx(l,{icon:f,className:`text-5xl mb-4 ${o.textColor||"text-indigo-600"}`}),e.jsx("h2",{className:"text-2xl font-semibold text-gray-700",children:"Belum Ada Berita"}),e.jsx("p",{className:"mt-2",children:"Silakan hubungi administrator untuk menambahkan konten berita."}),e.jsxs("a",{href:`https://wa.me/${x.whatsappNumber}`,target:"_blank",rel:"noopener noreferrer",className:"mt-5 inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-full shadow-sm text-white bg-green-500 hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500",children:[e.jsx(l,{icon:L,className:"w-4 h-4 mr-2 inline-block"}),"Hubungi Kami"]})]}),m.length===0&&i.length>0&&e.jsxs(r.div,{initial:{opacity:0},animate:{opacity:1},className:"flex flex-col items-center justify-center text-center py-12 text-gray-500 bg-white rounded-xl shadow-lg mt-12",children:[e.jsx(l,{icon:f,className:`text-5xl mb-4 ${o.textColor||"text-indigo-600"}`}),e.jsx("h2",{className:"text-2xl font-semibold text-gray-700",children:"Tidak Ditemukan"}),e.jsxs("p",{className:"mt-2",children:['Tidak ada berita yang cocok dengan kategori "',c,'". Coba filter yang lain.']})]}),v>1&&e.jsx(r.div,{initial:{opacity:0},animate:{opacity:1},className:"mt-16 flex justify-center items-center space-x-2"})]})})]})}const y=document.createElement("style");y.innerHTML=".line-clamp-3 { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }";document.head.appendChild(y);export{W as default};
