1var t,e,n,a,i,r,o,c=Object.freeze,s=Object.defineProperty,l=(t,e)=>c(s(t,"raw",{value:c(e||t.slice())}));import{p as m,u as d,r as p,j as g,b as u,o as h,d as y,m as f}from"./vendor-react-C0S3-DC5.js";import"./Breadcrumbs-BaBIPReQ.js";import{a as b,g as x,S as j}from"./main-21CQPKsQ.js";import{A as v}from"./ArticleCard-CE9Rlg1V.js";import{L as S}from"./LoadingSpinner-S8q5Vox6.js";import{P as A}from"./Pagination-CH-Wn3Lc.js";const w=()=>{const{category:t,lang:e}=m(),n=b(t,e)||t,{t:a}=d(),[i,r]=p.useState(null),[o,c]=p.useState([]),[s,l]=p.useState(!0),[y,f]=p.useState(null),[w,$]=p.useState(1),[B,N]=p.useState(1);p.useEffect((()=>{t&&e&&fetch("https://lev3lup.be/blog/wp-json/lev3lup/v1/category?slug=".concat(t,"&language=").concat(e)).then((t=>t.json())).then((t=>r(t))).catch((()=>r(null)))}),[t,e]);const T=async n=>{try{l(!0);const a=b(t,e)||t;console.log("slug:",t,"lang:",e,"categorySlug:",a);const i=await x({lang:e,category:a,perPage:12,page:n});c(i.data||[]),N(i.total_pages||1)}catch(i){f(a("errors.fetchArticles"))}finally{l(!1)}};p.useEffect((()=>{$(1),T(1)}),[e,t]);const V={title:i&&i.name?"".concat(i.name," | ").concat(a("meta.site.title")):a("meta.site.title"),description:i&&i.description?i.description:a("meta.site.description")};return g(P,y?{children:[u(j,{title:V.title,description:V.description}),u(z,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5},children:u(k,{children:a("errors.fetchArticles")})})]}:{children:[u(j,{title:V.title,description:V.description}),g(z,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},transition:{duration:.5},children:[u(k,{children:i&&i.name?i.name:a("meta.category.title",{defaultValue:"Catégorie"})}),u(C,{children:i&&i.description?i.description:""})]}),u(E,{initial:{opacity:0}
1,animate:{opacity:1},transition:{duration:.5,delay:.2},$loading:s,children:s?g(h,{children:[[...Array(6)].map(((t,e)=>u(O,{},e))),u(L,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.3},children:u(S,{})})]}):o.length>0?o.filter((t=>Array.isArray(t.categories)&&t.categories.some((t=>t.slug===n)))).map((t=>u(v,{article:t,lang:e,categoryName:i&&i.name?i.name:""},t.id))):u(C,{children:a("errors.noArticles")})}),B>1&&!s&&u(A,{currentPage:w,totalPages:B,onPageChange:t=>{$(t),T(t),window.scrollTo({top:0,behavior:"smooth"})}})]})},P=y(f.div)(t||(t=l(["\n max-width: 1200px;\n margin: 0 auto;\n padding: 2rem;\n"]))),z=y(f.div)(e||(e=l(["\n text-align: center;\n margin-bottom: 2rem;\n"]))),k=y.h1(n||(n=l(["\n color: ",";\n font-size: 2.5rem;\n margin-bottom: 1rem;\n"])),(({theme:t})=>t.text)),C=y.p(a||(a=l(["\n color: ",";\n font-size: 1.1rem;\n max-width: 600px;\n margin: 0 auto;\n"])),(({theme:t})=>t.textSecondary)),E=y(f.div)(i||(i=l(["\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));\n gap: 2rem;\n margin: 2rem 0;\n min-height: ",";\n"])),(t=>t.$loading?"500px":"auto")),L=y(f.div)(r||(r=l(["\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: ","99;\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 1;\n"])),(({theme:t})=>t.background)),O=y.div(o||(o=l(["\n background: ",";\n border-radius: 8px;\n height: 400px;\n opacity: 0.5;\n"])),(({theme:t})=>t.primary));export{w as default}; 2//# sourceMappingURL=CategoryPage-CQAsSBDy.js.map
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.