text: (this["webpackJsonpmyquiz-client"]=this["webpackJsonpmyquiz-client"]||[]).push([[9],{104:function(e,a,t){"use strict";t.r(a);var n=t(81),c=t(0),l=t.n(c),r=t(19),s=t(2),i=t(20),u=t(23),m=function(e){var a=e.handleOnClick,t="burger__btn "+(e.isActive?"burger__btn--active":"");return c.createElement("div",{className:t,onClick:function(){return a()}},c.createElement("span",null),c.createElement("span",null),c.createElement("span",null))},o=t(22),b=function(e){var a=e.url,t=void 0===a?"/":a,n=e.label,l=e.iconName,r=e.directUrl;return r?c.createElement("a",{href:r,className:"btn btn__icon f--s"},c.createElement("span",{className:"icon__wrapper icon--3"},c.createElement("img",{src:"/asset/icons/common/"+l,className:"icon",alt:""})),c.createElement("span",null,n)):c.createElement(o.b,{className:"btn btn__icon f--s",to:t},c.createElement("span",{className:"icon__wrapper icon--3"},c.createElement("img",{src:"/asset/icons/common/"+l,className:"icon",alt:""})),c.createElement("span",null,n))},E=(t(97),function(e){var a=e.isActive,t=e.handleOnClick,n=e.userState,l=e.handleOnLogout,r=n.isLogin,s=n.isTeacher,i="drawer "+(a?"drawer--active":""),u="drawer__mask "+(a?"drawer__mask--active":""),m=c.createElement(c.Fragment,null,c.createElement(b,{url:"/user/login",label:"Log in",iconName:"login.svg"}),c.createElement(b,{url:"/user/login",label:"Sign up",iconName:"profile.svg"})),o=c.createElement(c.Fragment,null,c.createElement(b,{url:"/user/profile",label:"Profile",iconName:"profile.svg"}));return c.createElement(c.Fragment,null,c.createElement("div",{className:i},r?o:m,c.createElement(b,{url:"/quiz/search/all/1",label:"Find quiz",iconName:"find.svg"}),c.createElement(b,{url:"/quiz/new",label:"Add new quiz",iconName:"plus.svg"}),s?c.createElement(b,{url:"/quiz/new",label:"Create an exam",iconName:"exam.svg"}):c.createElement(b,{url:"/quiz/search/exam/all/1",label:"Take an exam",iconName:"exam.svg"}),c.createElement(b,{url:"#",directUrl:"https://www.facebook.com/Heaty566",label:"Help center",iconName:"help.svg"}),r&&c.createElement("button",{className:"btn btn__icon f--c",onClick:function(){return l()}},c.createElement("span",{className:"icon__wrapper icon--3"},c.createElement("img",{src:"/asset/icons/common/login.svg",alt:"",className:"icon"})),c.createElement("span",null,"Log out"))),c.createElement("div",{className:u,onClick:function(){return t()}}))}),_=t(84),h=t(88),f=t(28),C=t(34),p=t(3),v=t(91),g=function(e){var a=e.register,t=e.quizState,n=e.apiState,c=e.userState,r=e.watcher,s=e.handleOnEnter,i=e.handleOnClickMenu,u=l.a.createElement(l.a.Fragment,null,l.a.createElement(o.b,{to:"/user/login",className:"navbtn__btn"},"Log in"),l.a.createElement(v.a,{label:"Sign Up",url:"/user/login"})),m=l.a.createElement("div",{className:"navbtn__user f--c",onClick:function(){return i()}},l.a.createElement("div",{className:"user__avatar"},l.a.createElement("img",{src:"/asset/images/avatar.png",alt:""})),l.a.createElement("div",{className:"user__btn"},l.a.createElement("span",null),l.a.createElement("span",null),l.a.createElement("span",null)));return l.a.createElement("div",{className:"navbtn"},l.a.createElement("div",{className:"navbtn__search"},l.a.createElement("span",{className:"icon__wrapper icon--3"},l.a.createElement("img",{src:"/asset/icons/common/find-white.svg",alt:"",className:"icon"})),l.a.createElement("input",{type:"text",className:"navbtn__search__box",placeholder:"Search...",name:"search",autoComplete:"off",ref:function(e){return a(e)},onKeyDown:function(e){return s(e)}}),l.a.createElement("ul",{className:"navbtn__search__result"},n.isLoading?l.a.createElement("li",{className:"search__result__item"},l.a.createElement("span",{className:"search__result__link"},"Search ...")):!t.searchQuizzes.length&&r?l.a.createElement("li",{className:"search__result__item"},l.a.createElement("a",{className:"search__result__link",href:"#/"},"Not found")):t.searchQuizzes.slice(0,10).map((function(e){return l.a.createElement("li",{className:"search__result__item",key:e._id},l.a.createElement("a",{className:"search__result__link",href:"/quiz/search/".concat(n.type,"/").concat(e.name,"/1")},e.name))})))),c.isLogin?m:u)},d=function(e){var a=e.userState,t=e.handleOnClick,n=Object(r.b)(C.b),i=Object(r.b)(p.b),m=Object(s.g)(),o=Object(_.b)({defaultValues:{search:""}}),b=o.register,E=(0,o.watch)("search"),v=Object(h.a)(E,1e3),d=Object(c.useCallback)((function(e){u.a.dispatch(Object(f.c)({input:e.trim()}))}),[]);Object(c.useEffect)((function(){v&&d(v)}),[v,d]);return l.a.createElement(g,{apiState:i,handleOnClickMenu:t,quizState:n,register:b,handleOnEnter:function(e){13===e.keyCode&&Boolean(E.length)&&m.push("/quiz/search/".concat(i.type,"/").concat(E,"/1"))},userState:a,watcher:E})},L=function(e){var a=e.isActiveMenu,t=e.onActiveMenu,n=e.userState,c=e.onLogoutUser;return l.a.createElement(l.a.Fragment,null,l.a.createElement(E,{isActive:a,handleOnClick:t,userState:n,handleOnLogout:c}),l.a.createElement("header",{className:"navbar f--b"},l.a.createElement(o.b,{to:"/home"},l.a.createElement("svg",{width:"80",height:"24",viewBox:"0 0 80 24",fill:"none"},l.a.createElement("path",{d:"M7.64453 0.9375L9.74219 13.2773L16.1055 0.9375H20.6758L17.7109 18H14.2656L15.1094 13.1367L16.7734 5.54297L10.2344 18H7.87891L5.59375 5.10938L4.49219 13.5117L3.70703 18H0.273438L3.23828 0.9375H7.64453ZM25.9492 13.1719L29.5703 5.32031H33.25L25.832 19.9102C25.3008 21.0273 24.6758 21.8477 23.957 22.3711C23.2461 22.8945 22.4219 23.1562 21.4844 23.1562C21.1172 23.1562 20.5859 23.0742 19.8906 22.9102L20.1367 20.332L20.5938 20.3555C21.6719 20.3867 22.4609 19.9922 22.9609 19.1719L23.6875 17.8242L21.6133 5.32031H25.0352L25.9492 13.1719ZM43.5742 16.8867L45.9414 19.207L43.5977 21.0469L40.6094 18.1406C40.1641 18.2109 39.75 18.2383 39.3672 18.2227C37.6641 18.207 36.2891 17.6289 35.2422 16.4883C34.1953 15.3477 33.6133 13.8125 33.4961 11.8828C33.4258 10.9219 33.4961 9.85156 33.707 8.67188C33.918 7.48438 34.2695 6.39453 34.7617 5.40234C35.2539 4.41016 35.8555 3.55859 36.5664 2.84766C37.2852 2.13672 38.1016 1.59766 39.0156 1.23047C39.9297 0.855469 40.8984 0.679688 41.9219 0.703125C43.0625 0.726562 44.0625 0.996094 44.9219 1.51172C45.7812 2.02734 46.4609 2.76953 46.9609 3.73828C47.4609 4.70703 47.7461 5.81641 47.8164 7.06641C47.8555 7.74609 47.8359 8.42578 47.7578 9.10547L47.5586 10.4531C47.0352 13.3594 45.707 15.5039 43.5742 16.8867ZM44.3711 7.88672C44.4258 6.44141 44.2266 5.375 43.7734 4.6875C43.3281 3.99219 42.6562 3.62891 41.7578 3.59766C40.3281 3.55078 39.1914 4.18359 38.3477 5.49609C37.5117 6.80859 37.0391 8.64453 36.9297 11.0039C36.8516 12.3867 37.0352 13.4531 37.4805 14.2031C37.9258 14.9453 38.6172 15.332 39.5547 15.3633C40.7812 15.418 41.7969 14.9414 42.6016 13.9336C43.4062 12.918 43.9336 11.4844 44.1836 9.63281C44.2852 8.88281 44.3477 8.30078 44.3711 7.88672ZM56.4297 16.6875C55.4922 17.7422 54.3281 18.2578 52.9375 18.2344C51.7188 18.2188 50.7969 17.7812 50.1719 16.9219C49.5469 16.0625 49.3047 14.9297 49.4453 13.5234L50.8164 5.32031H54.1211L52.7266 13.5586C52.6953 13.8164 52.6914 14.0586 52.7148 14.2852C52.793 15.0664 53.2266 15.4688 54.0156 15.4922C55.0391 15.5234 55.8867 15.1289 56.5586 14.3086L58.1406 5.32031H61.4688L59.2656 18H56.1836L56.4297 16.6875ZM65.2188 18H61.8906L64.0938 5.32031H67.4219L65.2188 18ZM64.4805 2.09766C64.4648 1.57422 64.6367 1.14062 64.9961 0.796875C65.3555 0.453125 65.7891 0.28125 66.2969 0.28125C66.7969 0.265625 67.2305 0.417969 67.5977 0.738281C67.9648 1.05859 68.1562 1.47266 68.1719 1.98047C68.1875 2.46484 68.0234 2.88672 67.6797 3.24609C67.3438 3.60547 66.9023 3.79297 66.3555 3.80859C65.8633 3.82422 65.4297 3.67578 65.0547 3.36328C64.6875 3.05078 64.4961 2.62891 64.4805 2.09766ZM72.3438 15.2461L78.3203 15.2695L77.8398 18H67.6094L67.9961 15.7617L75.0625 8.08594L69.4961 8.0625L69.9766 5.32031H79.8555L79.4805 7.48828L72.3438 15.2461Z",fill:"#FEFEFE"}))),l.a.createElement(d,{userState:n,handleOnClick:t}),l.a.createElement(m,{handleOnClick:t,isActive:a})))};a.default=function(){var e=l.a.useState(!1),a=Object(n.a)(e,2),t=a[0],m=a[1],o=Object(s.g)(),b=Object(s.h)(),E=Object(r.b)(i.b),_=Object(c.useCallback)((function(){u.a.dispatch({type:i.c.logoutUser.type}),o.push("/home")}),[o]);return Object(c.useEffect)((function(){m(!1)}),[b.pathname]),l.a.createElement(L,{isActiveMenu:t,onActiveMenu:function(){return m(!t)},onLogoutUser:_,userState:E})}},88:function(e,a,t){"use strict";t.d(a,"a",(function(){return l}));var n=t(81),c=t(0);function l(e,a){var t=Object(c.useState)(e),l=Object(n.a)(t,2),r=l[0],s=l[1];return Object(c.useEffect)((function(){var t=setTimeout((function(){s(e)}),a);return function(){clearTimeout(t)}}),[e,a]),r}},91:function(e,a,t){"use strict";var n=t(0),c=t(22);a.a=function(e){var a=e.label,t=e.url,l=e.size,r="btn btn__link "+("lg"===(void 0===l?"sm":l)?"btn--lg":"btn--sm");return n.createElement(c.b,{to:t,className:r},a)}},97:function(e,a,t){}}]);
  //# sourceMappingURL=9.904c212f.chunk.js.map