PageSourceSearch

https://geraldhoughauthor.com/_nuxt/B5Fwlu_7.js

js geraldhoughauthor.com collected 2026-10-08 07:23:27 UTC 4,590 bytes, 1 lines download raw bytes

1import{f as j,o as i,c as u,a as l,F as v,r as x,G as R,t as b,n as a,m as k,A as B,y as w,U as y,P as U,Q as p,R as D,b as _,w as f,i as E,S as H,j as L,d as P,T as Q,s as I,k as $,l as J}from"./kySYGeoE.js";import{_ as K,b as W}from"./CgBAce1F.js";import{t as X}from"./yI7HeE6Z.js";import"./ohXwhHiD.js";const Y={key:0,class:"isolate flex justify-center"},Z={class:"inline-flex -space-x-px shadow-xs rounded-full"},q=["disabled"],ee=["disabled","onClick"],te=["disabled"],N=3,ne=j({__name:"Paginator",props:{currentPage:{},totalPages:{}},emits:["goToPage"],setup(n,{emit:s}){const o=s,r=B(()=>{const c=Math.max(1,n.currentPage-N),e=Math.min(n.totalPages,n.currentPage+N),t=[];for(let g=c;g<=e;g++)t.push(g);return t});return(c,e)=>n.totalPages>1?(i(),u("nav",Y,[l("div",Z,[l("button",{class:"w-10 h-12 relative inline-flex items-center justify-center ring-1 ring-inset ring-dark/30 cursor-pointer disabled:cursor-not-allowed text-neutral-900 rounded-l-full",disabled:n.currentPage===1,onClick:e[0]||(e[0]=t=>o("goToPage",n.currentPage-1))},[...e[2]||(e[2]=[l("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-4"},[l("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 19.5 8.25 12l7.5-7.5"})],-1)])],8,q),(i(!0),u(v,null,x(a(r),t=>(i(),u("button",{key:t,class:R(["w-10 h-12 relative inline-flex items-center justify-center ring-1 ring-inset ring-dark/30 cursor-pointer disabled:cursor-not-allowed text-neutral-900",{"bg-accent text-light z-10":n.currentPage===t}]),disabled:n.currentPage===t,onClick:g=>o("goToPage",t)},b(t),11,ee))),128)),l("button",{class:"w-10 h-12 relative inline-flex items-center justify-center ring-1 ring-inset ring-dark/30 cursor-pointer disabled:cursor-not-allowed text-neutral-900 rounded-r-full",disabled:n.currentPage===n.totalPages,onClick:e[1]||(e[1]=t=>o("goToPage",n.currentPage+1))},[...e[3]||(e[3]=[l("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-4"},[l("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m8.25 4.5 7.5 7.5-7.5 7.5"})],-1)])],8,te)])])):k("",!0)}}),se=Object.assign(ne,{__name:"UiPaginator"});class oe{currentPage=w(1);itemsPerPage=5;totalPages;collections;url;constructor(s,o,r,c=5){if(this.collections=s,this.url=o,this.itemsPerPage=c,!this.collections.length)this.totalPages=1,this.currentPage.value=1;else if(this.totalPages=Math.ceil(this.collections.length/this.itemsPerPage),"page"in r&&!Number.isNaN(r.page)){const e=Number(r.page);e>0&&e<=this.totalPages?this.currentPage.value=e:y(`${this.url}?page=${this.currentPage.value}`)}}paginatedCollections=()=>{const s=(this.currentPage.value-1)*this.itemsPerPage,o=s+this.itemsPerPage;return this.collections.slice(s,o)};goToPage=s=>{s>0&&s<=this.totalPages&&(this.currentPage.value=s,y(`${this.url}?page=${this.currentPage.value}`))}}const ae={class:"mx-auto max-w-3xl"},le={class:"mb-4 md:mb-12"},ie={key:0},re={class:"flex flex-wrap gap-2"},ce={key:0,class:"grid grid-cols-1 md:grid-cols-3 gap-6"},ue=!0,T="the-logbook",fe=j({__name:"index",setup(n){const s=U(),o=p("blog-page"),r=p("blog-posts");D({page:"blog-page",title:"Blog",description:X(o.body.value,155,H)});const c=w(r),e=B(()=>new oe(c.value,`/${T}`,s.query)),t=w(null),g=p("blog-categories"),M=h=>{h===t.value?(t.value=null,c.value=r):(t.value=h,c.value=r.filter(m=>m.fields.category?m.fields.category.fields.name.value===t.value:!1))};return(h,m)=>{const z=L,S=Q,V=I,F=K,G=J,C=E,A=W,O=se;return i(),u("div",null,[_(C,{first:"",light:""},{default:f(()=>[l("div",ae,[l("div",le,[_(z,{as:"h1"},{default:f(()=>[P(b(a(o)?.heading.value),1)]),_:1}),_(S),_(V,{field:a(o)?.body},null,8,["field"])]),a(g).length&&ue?(i(),u("div",ie,[_(F,{class:"mb-3"},{default:f(()=>[...m[0]||(m[0]=[P("Filter by category",-1)])]),_:1}),l("div",re,[(i(!0),u(v,null,x(a(g),d=>(i(),$(G,{key:d.id,class:"cursor-pointer",active:a(t)===d.fields.name.value,onClick:()=>M(d.fields.name.value)},{default:f(()=>[P(b(d.fields.name.value),1)]),_:2},1032,["active","onClick"]))),128))])])):k("",!0)])]),_:1}),_(C,{dark:"",large:""},{default:f(()=>[l("div",null,[a(e).paginatedCollections().length?(i(),u("div",ce,[(i(!0),u(v,null,x(a(e).paginatedCollections(),d=>(i(),$(A,{key:d.fields.heading.value,post:d,"page-name":T,class:"h-full"},null,8,["post"]))),128)),_(O,{"current-page":a(e).currentPage.value,"total-pages":a(e).totalPages,onGoToPage:a(e).goToPage},null,8,["current-page","total-pages","onGoToPage"])])):k("",!0)])]),_:1})])}}});
1export{fe 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.