1import{x as w,h as _,r as c,j as e,L as x}from"./index-wOwJRo7J.js";import{S as C}from"./SiteLayout-CZUI1wox.js";import{C as k}from"./clock-Bx74EMO3.js";import"./createLucideIcon-DVy341pS.js";import"./x-40JNUk0O.js";const m=12,S="https://images.unsplash.com/photo-1486312338219-ce68d2c6f44d?auto=format&fit=crop&w=1200&q=70";function P(r){return r.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function E(r){try{return new Date(r).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",timeZone:"UTC"})}catch{return r}}function L(r,o=120){const s=(r.quick_answer||r.site_meta_description||r.meta_description||(r.unique_intro??"").replace(/<[^>]+>/g," ")).trim().replace(/\s+/g," ");return s.length>o?`${s.slice(0,o).trimEnd()}â¦`:s}function q(){const r=w.useLoaderData(),{siteConfig:o}=_({from:"__root__"}),a=r.posts,[s,d]=c.useState("all"),[j,i]=c.useState(1),u=c.useMemo(()=>{const t=new Set;for(const b of a)b.category&&t.add(b.category);return Array.from(t).sort()},[a]),g=c.useMemo(()=>s==="all"?a:a.filter(t=>t.category===s),[a,s]),l=Math.max(1,Math.ceil(g.length/m)),n=Math.min(j,l),p=(n-1)*m,h=g.slice(p,p+m),[f,...N]=s==="all"&&n===1?h:[],v=s==="all"&&n===1?N:h;return e.jsxs(C,{children:[e.jsx("section",{className:"border-b border-border bg-surface",children:e.jsxs("div",{className:"mx-auto max-w-7xl px-4 py-10 sm:px-6 lg:px-8",children:[e.jsxs("nav",{className:"text-sm text-muted-foreground",children:[e.jsx(x,{to:"/",className:"hover:text-foreground",children:"Home"}),e.jsx("span",{className:"mx-2",children:"/"}),e.jsx("span",{className:"text-foreground",children:"Blog"})]}),e.jsxs("h1",{className:"mt-3 font-display text-3xl font-semibold tracking-tight sm:text-4xl",children:["The ",o.city||"Local"," Business Guide"]}),e.jsxs("p",{className:"mt-2 max-w-2xl text-muted-foreground",children:["Editorial guides and local reporting from ",o.name,"."]})]})}),e.jsxs("section",{className:"mx-auto max-w-7xl px-4 py-10 sm:px-6 lg:px-8",children:[u.length>0&&e.jsxs("div",{className:"mb-8 flex flex-wrap gap-2",children:[e.jsx($,{active:s==="all",onClick:()=>{d("all"),i(1)},children:"All posts"}),u.map(t=>e.jsx(x,{to:"/blog/category/$slug",params:{slug:P(t)},className:"rounded-full border border-border bg-card px-4 py-1.5 text-sm font-medium text-foreground transition hover:bg-secondary",children:t},t))]}),a.length===0&&e.jsx("div",{className:"rounded-2xl border border-border bg-card p-12 text-center text-muted-foreground",children:"No published posts yet. New articles pushed from SearchRush will appear here."}),f&&e.jsx("div",{className:"mb-10",children:e.jsx(y,{post:f,variant:"featured"})}),e.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:v.map(t=>e.jsx(y,{post:t},t.id))}),l>1&&e.jsxs("div",{className:"mt-10 flex items-center justify-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>i(t=>Math.max(1,t-1)),disabled:n===1,className:"rounded-md border border-border bg-card px-3 py-1.5 text-sm font-medium disabled:opacity-40",children:"â Prev"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["Page ",n," of ",l]}),e.jsx("button",{type:"button",onClick:()=>i(t=>Math.min(l,t+1)),disabled:n===l,className:"rounded-md border border-border bg-card px-3 py-1.5 text-sm font-medium disabled:opacity-40",children:"Next â"})]})]})]})}function $({active:r,onClick:o,children:a}){return e.jsx("button",{type:"button",onClick:o,className:`rounded-full border px-4 py-1.5 text-sm font-medium transition ${r?"border-primary bg-primary text-primary-foreground":"border-border bg-card text-foreground hover:bg-secondary"}`,children:a})}function y({post:r,variant:o="default"}){const a=r.cover_image_url||S,s=Array.isArray(r.tags)?r.tags.slice(0,3):[];return e.jsxs(x,{to:"/blog/$slug",params:{slug:r.slug},className:"group flex flex-col overflow-hidden rounded-2xl border border-border bg-card shadow-card transition-all duration-200 hover:-translate-y-0.5 hover:shadow-card-hover",children:[e.jsx("div",{className:`relative ${o==="featured"?"aspect-[16/9]":"aspect-[4/3]"} w-full overflow-hidden bg-secondary`,style:{backgroundImage:`url(${a})`,backgroundSize:"cover",backgroundPosition:"center"},role:"img","aria-label":r.cover_image_alt??r.title}),e.jsxs("div",{className:"flex flex-1 flex-col p-5",children:[e.jsxs("div",{className:"flex items-center gap-3 text-xs uppercase tracking-wider text-muted-foreground",children:[r.category&&e.jsx("span",{className:"font-semibold text-primary",children:r.category}
1),r.category&&e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{children:E(r.published_at)})]}),e.jsx("h3",{className:`mt-2 font-display font-semibold leading-tight text-foreground transition-colors group-hover:text-primary ${o==="featured"?"text-2xl":"text-lg"}`,children:r.title}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground line-clamp-2",children:L(r)}),e.jsxs("div",{className:"mt-4 flex items-center gap-3 text-xs text-muted-foreground",children:[e.jsx("span",{children:r.author_name}),e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(k,{className:"h-3.5 w-3.5"})," ",r.estimated_read_time??4," min read"]})]}),s.length>0&&e.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:s.map(d=>e.jsxs("span",{className:"rounded-full border border-border bg-secondary/40 px-2 py-0.5 text-[11px] text-muted-foreground",children:["#",d]},d))})]})]})}export{q as component};
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.