import{h as A,c as d,d as v,j as e,L as u,r as h,S as z,m as V,B as p}from"./index-CJ26T8nM.js";import{I as q}from"./input-CnLsWnhN.js";import{B as D}from"./BlogCard-CAGUCHHS.js";import{C as j,a as f,d as b,b as N}from"./card-DVvLGBob.js";import{u as E,a as y}from"./useBlogData-D958aAFA.js";import{B as H}from"./BreadcrumbNavigation-DO0Fhgk5.js";import{S as O}from"./search-_DyM0Qzb.js";import"./clock-C5b7Nd5i.js";/**
* @license lucide-react v0.554.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const R=[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]],$=A("megaphone",R),F=({selectedCategory:t,onCategoryChange:l})=>{d("blog");const{t:r}=d("newsletter"),{getLocalizedPath:n}=v(),{categories:m}=E(),{posts:c}=y({limit:5}),g=m.filter(s=>s.slug!=="newsletter"),i=c.filter(s=>!s.categories?.some(o=>o?.slug==="newsletter"));return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(u,{to:n("/blog/newsletter"),className:"flex items-center justify-center gap-2 w-full px-4 py-3 bg-nature-amber hover:bg-nature-amber/90 text-white font-semibold rounded-lg shadow-sm transition-colors",children:[e.jsx($,{className:"h-4 w-4"}),e.jsx("span",{children:r("newslettersButton")})]}),e.jsxs(j,{children:[e.jsx(f,{children:e.jsx(b,{children:"Categories"})}),e.jsx(N,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("button",{onClick:()=>l("all"),className:`w-full text-left px-3 py-2 rounded-md transition-colors ${t==="all"||!t?"bg-nature-green text-white":"hover:bg-gray-100"}`,children:"All Categories"}),g.map(s=>e.jsx("button",{onClick:()=>l(s.slug),className:`w-full text-left px-3 py-2 rounded-md transition-colors ${t===s.slug?"bg-nature-green text-white":"hover:bg-gray-100"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:s.name}),e.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:s.color}})]})},s.id))]})})]}),e.jsxs(j,{children:[e.jsx(f,{children:e.jsx(b,{children:"Recent Posts"})}),e.jsx(N,{children:e.jsx("div",{className:"space-y-4",children:i.slice(0,5).map(s=>e.jsxs(u,{to:n(`/blog/${s.slug}`),className:"block group",children:[e.jsx("h4",{className:"font-medium text-sm group-hover:text-nature-green transition-colors line-clamp-2",children:s.title}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[s.reading_time_minutes," min read"]})]},s.id))})})]})]})},Z=()=>{const{t}=d("blog"),{t:l}=d("navbar"),{currentLanguage:r}=v(),[n,m]=h.useState("all"),[c,g]=h.useState(""),[i,s]=h.useState(0),{posts:o,loading:x,hasMore:w,refetch:C}=y({category:n,search:c,limit:9,offset:i}),k=a=>{a.preventDefault(),s(0),C()},S=()=>{s(i+9)},B=t("meta.title",{defaultValue:""}),L=t("meta.description",{defaultValue:""}),P=t("meta.keywords",{defaultValue:""}),M=B||t("title")+" | StorySparkle",I=L||t("subtitle"),T=r==="bn"?"/bn/blog":r==="es"?"/es/blog":r==="zh"?"/zh/blog":"/blog";return e.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-teal-100 via-yellow-200 to-red-300",children:[e.jsx(z,{title:M,description:I,keywords:P||void 0,canonical:T}),e.jsxs("div",{className:"container mx-auto px-4 py-8",children:[e.jsx(H,{items:[{name:l("home"),path:"/"},{name:l("blog"),path:"/blog"}]}),e.jsx("div",{className:"mb-12",children:e.jsxs("div",{className:"flex flex-col lg:flex-row items-center justify-center gap-6 lg:gap-8",children:[e.jsx("div",{className:"w-48 h-48 lg:w-56 lg:h-56 flex-shrink-0",children:e.jsx(V.div,{animate:{y:[0,-12,0]},transition:{duration:3,repeat:1/0,ease:"easeInOut"},children:e.jsx("img",{src:"https://cdn.storysparkle.org/ui_elements/Hero%20Icons/Blog.webp",alt:"Blog",className:"w-full h-full object-contain drop-shadow-2xl"})})}),e.jsxs("div",{className:"flex flex-col items-center lg:items-start text-center lg:text-left",children:[e.jsx("h1",{className:"text-5xl lg:text-6xl font-bold mb-4 text-black",children:t("title")}),e.jsx("p",{className:"text-lg lg:text-xl text-muted-foreground",children:t("subtitle")})]})]})}),e.jsx("div",{className:"max-w-md mx-auto mb-8",children:e.jsxs("form",{onSubmit:k,className:"flex gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(O,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),e.jsx(q,{type:"text",placeholder:t("searchPlaceholder"),value:c,onChange:a=>g(a.target.value),className:"pl-10"})]}),e.jsx(p,{type:"submit",className:"bg-nature-green hover:bg-nature-green/90",children:"Search"})]})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-8",children:[e.jsx("aside",{className:"lg:col-span-1",children:e.jsx(F,{selectedCategory:n,onCategoryChange:m})}),e.jsx("main",{className:"lg:col-span-3",children:x&&o.length===0?e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-6",children:[...Array(6)].map((a,_)=>e.jsxs("div",{className:"animate-pulse",children:[e.jsx("div",{className:"bg-gray-200 aspect-video rounded-t-lg mb-4"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-gray-200 rounded w-3/4"}),e.jsx("div",{className:"h-4 bg-gray-200 rounded w-1/2"})]})]},_))}):o.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-6 mb-8",children:o.map(a=>e.jsx(D,{post:a},a.id))}),w&&e.jsx("div",{className:"text-center",children:e.jsx(p,{onClick:S,variant:"outline",disabled:x,className:"px-8",children:x?"Loading...":t("loadMore")})})]}):e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-lg text-muted-foreground",children:t("noPostsFound")})})})]})]})]})};export{Z as default};
//# sourceMappingURL=BlogPage-CWEix8x9.js.map