1import{_ as k,r as R,o as r,c as l,a as s,l as I,v as P,al as $,f as d,b as h,w as p,i as v,t as _,F as m,h as g,g as A,P as x,j as N,x as j}from"./DQG6X4aI.js";import{_ as f}from"./Bo5-WjVJ.js";import{d as C}from"./cMgwstmh.js";import{d as F}from"./9NwTRMQo.js";const W=C({components:{blogPost:f,dateFormat:F},data(){return{posts:[],searchWord:"",searchResults:[],notFound:!1,placeholderImage:""}},methods:{scrollToSearchResults(){document.getElementById("searchResults"),window.scrollBy(0,300)},async searchPosts(){if(!this.searchWord){alert("Please enter Search Word! ");return}this.searchResults=[],this.$router.push("/news/?search="+this.searchWord);let e="https://gca.org/wp-json/wp/v2/search?search="+this.searchWord+"&_embed&per_page=15";try{const t=await this.$axios.get(e).then(o=>{if(Array.isArray(o.data)){let n=o.data;n.length&&n?(n.forEach(c=>{let u={...c,data:c._embedded.self[0]};this.searchResults.push(u)}),this.scrollToSearchResults()):(this.notFound=!0,setTimeout(()=>{this.notFound=!1},5e3))}}).catch(o=>{console.log(o)})}catch(t){console.log(t)}},clearSearch(){this.$router.push("/news"),this.searchWord="",this.searchResults=[]},async getPosts(){let e="https://acs.crestwood.co.ke/wp-json/wp/v2/posts/?_embed";e="https://gca.org/wp-json/wp/v2/posts/?_embed&per_page=30";try{const t=await this.$axios.get(e).then(o=>(Array.isArray(o.data)&&(this.posts=o.data),o.data)).then(()=>{const o=window.localStorage.setItem("news",JSON.stringify(this.posts))}).catch(o=>{console.log(o)})}catch(t){console.log(t)}},randomizeImage(){let e=["/ImageAssets/quotes/Mandela.jpg","/ImageAssets/quotes/Paul-Kagame.jpg","/ImageAssets/quotes/Samia-Suluhu.jpg","/ImageAssets/quotes/Soipan-Tuya.jpg"];const t=e[Math.floor(Math.random()*e.length)];return this.placeholderImage=t,t}},created(){this.getPosts(),this.randomizeImage()},mounted(){let e=JSON.parse(window.localStorage.getItem("news"));Array.isArray(e)&&(this.posts=e);let t=(this._.provides[x]||this.$route).query.search;t&&(this.searchWord=t,this.searchPosts())}},"$zNHINvfvSO"),B={class:"news-page"},T={class:"dark-blue-bg pt-32"},q={class:"max-width-wrapper"},V={class:"head flex justify-between flex-wrap"},E={class:"w-full md:w-1/2 md:pr-12 py-24"},M=s("div",{class:"bold-title"},[s("h1",null,"Africa Climate Summit News & Publications.")],-1),z=s("div",{class:"description"}," Browse all news, articles and press releases. ",-1),K={class:"search-section"},O={class:"input-section flex"},D={class:"flex lg:pl-4"},J={class:"relative"},L={class:"absolute results-not-found py-4 h-12 blue-text"},H={key:0},U={class:"lg:w-2/5 large-screen"},G=["src"],Q={class:"max-width-wrapper"},X={class:"py-24"},Y=s("div",{class:"filters"},null,-1),Z={key:0,class:"pb-12"},ss={class:"search-results-header flex items-center justify-between pb-4"},es=s("span",null,[v(" Results "),s("span",{class:"large-screen"}," found ")],-1),ts={id:"searchResults",class:"search-results grid md:grid-cols-2 lg:grid-cols-4 gap-8"},os={class:"title"},as={class:"date"},rs={key:1,class:"py-12 pb-12"},ls=s("h1",null,"Continue reading",-1),ns=[ls],is={key:0,class:"blogs grid md:grid-cols-2 lg:grid-cols-4 gap-8"},cs={key:1,class:"text-center"};function ds(e,t,o,n,c,u){const w=R("dateFormat"),y=N,b=j,S=f;return r(),l("div",B,[s("div",T,[s("div",q,[s("div",V,[s("div",E,[M,z,s("div",K,[s("div",O,[I(s("input",{placeholder:"Search for news",type:"text",class:"w-full h-14","onUpdate:modelValue":t[0]||(t[0]=a=>e.searchWord=a),onKeyup:t[1]||(t[1]=$(a=>e.searchPosts(),["enter"]))},null,544),[[P,e.searchWord]]),s("div",D,[s("div",{class:"secondary-button white-button h-14",onClick:t[2]||(t[2]=a=>e.searchPosts())}," Search ")])]),s("div",J,[s("div",L,[e.notFound?(r(),l("div",H,"No results found!")):d("",!0)])])])]),s("div",U,[s("img",{class:"header-image",src:e.placeholderImage,alt:""},null,8,G)])])])]),s("div",null,[s("div",Q,[s("div",X,[Y,h(b,null,{default:p(()=>[e.searchResults.length?(r(),l("div",Z,[s("div",ss,[s("h1",null,[v(_(e.searchResults.length)+" ",1),es]),s("div",{class:"primary-button",onClick:t[3]||(t[3]=a=>e.clearSearch())}," Clear search ")]),s("div",ts,[(r(!0),l(m,null,g(e.searchResults,(a,i)=>(r(),l("div",{class:"result",key:i},[h(y,{to:"/news/"+a.data.slug+"?id="+a.id},{default:p(()=>[s("div",os,_(a.title),1),s("div",as,[h(w,{date:a.data.date},null,8,["date"])])]),_:2},1032,["to"])]))),128))])])):d("",!0),e.searchResults.length?(r(),l("div",rs,ns)):d("",!0)]),_:1}),e.posts.length?(r(),l("div",is,[(r(!0),l(m,null,g(e.posts,(a,i)=>(r(),l("div",{class:"blog mb-6",key:i},[(r(),A(S,{post:a,key:i},null,8,["post"]))]))),128))])):(r(),l("div",cs,"Loading..."))])])])])}const ms=k(W,[["render",ds]]);
1export{ms 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.