text: (this["webpackJsonpgif-expert"]=this["webpackJsonpgif-expert"]||[]).push([[0],{12:function(e,t,n){},13:function(e,t,n){"use strict";n.r(t);var a=n(0),r=n.n(a),c=n(4),u=n.n(c),i=n(1),l=function(e){var t=e.setCategories,n=Object(a.useState)(""),c=Object(i.a)(n,2),u=c[0],l=c[1];return r.a.createElement("form",{onSubmit:function(e){e.preventDefault(),u.trim().length>2&&(t((function(e){return[u]})),l(""))}},r.a.createElement("input",{type:"text",placeholder:"Search...",value:u,onChange:function(e){return l(e.target.value)}}))},o=n(2),s=n.n(o),f=n(5),p=function(){var e=Object(f.a)(s.a.mark((function e(t){var n,a,r,c,u;return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="https://api.giphy.com/v1/gifs/search?q=".concat(encodeURI(t),"&api_key=8RxFYU11Hi6cCjYEJuQipJJ9965BaHUT"),e.next=3,fetch(n);case 3:return a=e.sent,e.next=6,a.json();case 6:return r=e.sent,c=r.data,u=c.map((function(e){var t;return{id:e.id,title:e.title,url:null===(t=e.images)||void 0===t?void 0:t.downsized_large.url}})),e.abrupt("return",u);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),m=function(e){var t=e.category,n=function(e){var t=Object(a.useState)({data:[],loading:!0}),n=Object(i.a)(t,2),r=n[0],c=n[1];return Object(a.useEffect)((function(){p(e).then((function(e){c({data:e,loading:!1})}))}),[e]),r}(t),c=n.data,u=n.loading;return r.a.createElement("div",null,r.a.createElement("h3",{className:"category__subtitle"},t),u&&r.a.createElement("p",null,"Loading..."),r.a.createElement("ul",{className:"Gifs__list fadeInUp"},c.map((function(e){return r.a.createElement("li",{key:e.id},r.a.createElement("img",{src:e.url,alt:e.title}))}))))},d=function(){var e=Object(a.useState)(["Spiderman"]),t=Object(i.a)(e,2),n=t[0],c=t[1];return r.a.createElement("div",null,r.a.createElement("h2",null,"GiftExpert"),r.a.createElement(l,{setCategories:c}),r.a.createElement("hr",null),n.map((function(e){return r.a.createElement(m,{key:e,category:e})})))};n(12);u.a.render(r.a.createElement(d,null),document.getElementById("root"))},6:function(e,t,n){e.exports=n(13)}},[[6,1,2]]]);
  //# sourceMappingURL=main.abc22354.chunk.js.map