1import{u as F,R as n,j as e}from"./LaravelTranslationContext-Z5orulYN.js";import{m as g,B as y}from"./createLucideIcon-wiHDCCZZ.js";import{C as E,a as $}from"./card-rkeDLvCO.js";import{B}from"./badge-C1XazNs3.js";import{I as L}from"./ImageWithFallback-BpHwV6oN.js";import{F as M}from"./FloatingActions-B11mfcI7.js";import{H as I,N as _,F as z}from"./FooterSection-ZsbcgFna.js";import{C as R}from"./calendar-DLskpEMl.js";import{E as A}from"./eye-CDThGX9B.js";import{E as D}from"./external-link-DD6t60gy.js";import{S as H}from"./share-2-CGknoift.js";import"./app-C7m2Ar8R.js";import"./index-DZ_Kha3d.js";/* empty css */function te({menuItems:m=[],links:p={},auth:x=null}){const{t}=F(),j=!!(x&&x.user),w=()=>m&&m.length>0?m.map(a=>({name:t(a.nameKey),href:a.href,active:a.active})):[{name:t("menu.home"),active:!1,href:"/"},{name:t("menu.certification"),active:!1,href:"/mengenai-pensijilan"},{name:t("menu.jobs"),active:!1,href:"/jawatan-kosong"},{name:t("menu.news"),active:!0,href:"/berita"},{name:t("menu.media"),active:!1,href:"/media"},{name:t("menu.contact"),active:!1,href:"/contact"}],[N,u]=n.useState([]),[s,d]=n.useState(1),[h,C]=n.useState(12),[T,f]=n.useState(!1),[i,b]=n.useState(1),[S,v]=n.useState(0),k=async a=>{var l,c;f(!0);try{const r=await fetch(`/api/news?page=${a}&per_page=${h}`,{headers:{Accept:"application/json"}});if(!r.ok)throw new Error("Failed to load");const o=await r.json();u((o==null?void 0:o.data)||[]),b(((l=o==null?void 0:o.meta)==null?void 0:l.last_page)||1),v(((c=o==null?void 0:o.meta)==null?void 0:c.total)||0)}catch{u([]),b(1),v(0)}finally{f(!1)}};n.useEffect(()=>{k(s)},[s,h]);const P=()=>{const a=[];if(i<=7){for(let r=1;r<=i;r++)a.push(r);return a}a.push(1);
1const l=Math.max(2,s-2),c=Math.min(i-1,s+2);l>2&&a.push("...left");for(let r=l;r<=c;r++)a.push(r);return c<i-1&&a.push("...right"),a.push(i),a};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"min-h-screen bg-white overflow-y-auto",style:{fontFamily:"Montserrat, sans-serif"},children:[e.jsx(I,{selectedProgram:"",onBack:()=>window.history.back()}),e.jsx(_,{menuItems:w(),links:p,auth:x,isLoggedIn:j}),e.jsxs(g.div,{className:"relative py-20 px-4 sm:px-6 overflow-hidden",style:{backgroundColor:"#211b4e"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.8},children:[e.jsxs("div",{className:"absolute inset-0 opacity-10",children:[e.jsx("div",{className:"absolute top-10 left-10 w-20 h-20 border-2 border-white/30 rounded-full"}),e.jsx("div",{className:"absolute top-32 right-20 w-16 h-16 border-2 border-white/30 rounded-lg rotate-45"}),e.jsx("div",{className:"absolute bottom-20 left-1/4 w-12 h-12 border-2 border-white/30 rounded-full"}),e.jsx("div",{className:"absolute bottom-32 right-10 w-24 h-24 border-2 border-white/30 rounded-lg rotate-12"})]}),e.jsx("div",{className:"max-w-6xl mx-auto text-center relative z-10",children:e.jsxs(g.div,{initial:{opacity:0,y:30},animate:{opacity:1,y:0},transition:{duration:.8,delay:.2},className:"mb-8",children:[e.jsx("h2",{className:"text-4xl md:text-6xl font-bold text-white mb-6 leading-tight",children:t("news.title")}),e.jsx("p",{className:"text-xl text-white/90 max-w-4xl mx-auto leading-relaxed",children:t("news.subtitle")})]})})]}),e.jsx(g.div,{className:"py-16 px-4 sm:px-6 bg-white",initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.6,delay:.2},children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6",children:N.map(a=>e.jsxs(E,{className:"overflow-hidden hover:shadow-lg transition-all duration-300 group h-full flex flex-col",children:[e.jsxs("div",{className:"relative",children:[e.jsx(L,{src:a.image,alt:a.title,className:"w-full h-48 object-cover group-hover:scale-105 transition-transform duration-300"}),a.category?e.jsx("div",{className:"absolute top-4 left-4",children:e.jsx(B,{className:"bg-[#90ce57] text-white",children:a.category})}):null]}),e.jsxs($,{className:"p-6 flex-1 flex flex-col",children:[e.jsxs("div",{className:"flex items-center text-gray-500 text-sm mb-3",children:[e.jsx(R,{className:"w-4 h-4 mr-2"}),a.published_at?new Date(a.published_at).toLocaleDateString("ms-MY"):"",e.jsx(A,{className:"w-4 h-4 ml-4 mr-2"}),a.views||0]}),e.jsx("h4",{className:"font-semibold text-lg text-gray-900 mb-3 group-hover:text-[#6051bf] transition-colors",children:a.title}),e.jsx("p",{className:"text-gray-600 mb-4 line-clamp-3 flex-grow",children:a.excerpt||""}),e.jsxs("div",{className:"flex items-center justify-between mt-auto",children:[e.jsxs(y,{variant:"outline",size:"sm",className:"border-[#6051bf] text-[#6051bf] hover:bg-[#6051bf] hover:text-white",onClick:()=>window.location.href=`/berita/${a.id}`,children:[t("news.read.more"),e.jsx(D,{className:"w-4 h-4 ml-2"})]}),e.jsx(y,{variant:"ghost",size:"sm",className:"text-gray-500",children:e.jsx(H,{className:"w-4 h-4"})})]})]})]},a.id))}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between mt-8 gap-4",children:[e.jsxs("div",{className:"text-sm text-gray-600",children:[t("news.total"),": ",S]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{className:`px-3 py-2 rounded border ${s<=1?"text-gray-400 border-gray-200 cursor-not-allowed":"text-gray-700 hover:bg-gray-100 border-gray-300"}`,onClick:()=>s>1&&d(s-1),disabled:s<=1,children:t("pagination.prev")}),P().map((a,l)=>typeof a=="number"?e.jsx("button",{className:`px-3 py-2 rounded border ${a===s?"bg-[#6051bf] text-white border-[#6051bf]":"text-gray-700 hover:bg-gray-100 border-gray-300"}`,onClick:()=>d(a),children:a},l):e.jsx("span",{className:"px-2 text-gray-400",children:"â¦"},l)),e.jsx("button",{className:`px-3 py-2 rounded border ${s>=i?"text-gray-400 border-gray-200 cursor-not-allowed":"text-gray-700 hover:bg-gray-100 border-gray-300"}`,onClick:()=>s<i&&d(s+1),disabled:s>=i,children:t("pagination.next")})]}),e.jsx("div",{children:e.jsxs("select",{className:"border border-gray-300 rounded px-2 pr-10 py-2 text-sm w-48",value:h,onChange:a=>{d(1),C(Number(a.target.value)||12)},children:[e.jsxs("option",{value:9,children:["9 ",t("pagination.per.page")]}),e.jsxs("option",{value:12,children:["12 ",t("pagination.per.page")]}),e.jsxs("option",{value:18,children:["18 ",t("pagination.per.page")]}),e.jsxs("option",{value:24,children:["24 ",t("pagination.per.page")]})]})})]})]})}),e.jsx(z,{links:p})]}),e.jsx(M,{})]})}
1export{te as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.