text: (this.webpackJsonpemployee=this.webpackJsonpemployee||[]).push([[0],{23:function(e,t,n){},25:function(e,t,n){},26:function(e,t,n){},27:function(e,t,n){},28:function(e,t,n){},46:function(e,t,n){"use strict";n.r(t);var r=n(0),c=n(1),s=n.n(c),a=n(16),i=n.n(a),l=(n(23),n(24),n.p+"static/media/logo.6ce24c58.svg"),o=(n(25),n(3)),j=n(4),d=n(6),h=n(5),u=(n(26),function(e){Object(d.a)(n,e);var t=Object(h.a)(n);function n(){return Object(o.a)(this,n),t.apply(this,arguments)}return Object(j.a)(n,[{key:"render",value:function(){return Object(r.jsx)("div",{className:"header",children:Object(r.jsx)("h1",{children:"Employee Directory"})})}}]),n}(c.Component));var b=function(e){return Object(r.jsx)("div",{className:"container".concat(e.fluid?"-fluid":""),children:e.children})};var m=function(e){return Object(r.jsx)("div",{className:"row".concat(e.fluid?"-fluid":""),children:e.children})};var O=function(e){var t=e.size.split(" ").map((function(e){return"col-"+e})).join(" ");return Object(r.jsx)("div",{className:t,children:e.children})};n(27);var p=function(e){return Object(r.jsxs)("div",{className:"card text-center",children:[Object(r.jsx)("div",{className:"card-header",children:Object(r.jsx)("h2",{children:e.heading})}),Object(r.jsx)("div",{className:"card-body",children:e.children})]})};var x=function(e){return Object(r.jsx)("form",{children:Object(r.jsxs)("div",{className:"form-group",children:[Object(r.jsx)("label",{htmlFor:"search",children:"Search:"}),Object(r.jsx)("input",{onChange:e.handleInputChange,value:e.value,name:"search",type:"text",className:"form-control",placeholder:"Employee Search",id:"search"}),Object(r.jsx)("br",{}),Object(r.jsx)("button",{onClick:e.handleFormSubmit,className:"btn btn-primary",children:"Search"})]})})};n(28);var f=function(e){return Object(r.jsxs)("table",{children:[Object(r.jsx)("thead",{children:Object(r.jsxs)("tr",{children:[Object(r.jsx)("th",{}),Object(r.jsx)("th",{onClick:e.sortEmByName,children:"Name"}),Object(r.jsx)("th",{children:"Email"}),Object(r.jsx)("th",{children:"Phone"}),Object(r.jsx)("th",{children:"D.O.B."})]})}),Object(r.jsx)("tbody",{className:"",children:e.results.map((function(e){return Object(r.jsxs)("tr",{children:[Object(r.jsx)("td",{children:Object(r.jsx)("img",{alt:"",src:e.picture.thumbnail})}),Object(r.jsx)("td",{children:Object(r.jsx)("p",{children:e.name.first+" "+e.name.last})}),Object(r.jsx)("td",{children:Object(r.jsx)("p",{children:e.email})}),Object(r.jsx)("td",{children:Object(r.jsx)("p",{children:e.phone})}),Object(r.jsx)("td",{children:Object(r.jsx)("p",{children:e.dob.date})})]},e.login.uuid)}))})]})},v=n(17),y=n.n(v),g=function(e){return y.a.get("https://randomuser.me/api/?results=200&nat=us")},N=function(e){Object(d.a)(n,e);var t=Object(h.a)(n);function n(){var e;Object(o.a)(this,n);for(var r=arguments.length,c=new Array(r),s=0;s<r;s++)c[s]=arguments[s];return(e=t.call.apply(t,[this].concat(c))).state={search:"",employeeList:[],employeeFilter:[],listOrder:""},e.sortEmByName=function(){var t=e.state.employeeFilter;if("ascending"===e.state.listOrder){var n=t.sort((function(e,t){return e.name.first>t.name.first?1:-1}));e.setState({employeeFilter:n,listOrder:"descending"})}else{var r=t.sort((function(e,t){return e.name.first>t.name.first?-1:1}));e.setState({employeeFilter:r,listOrder:"ascending"})}},e.searchUsers=function(){g().then((function(t){return e.setState({employeeList:t.data.results,employeeFilter:t.data.results})})).catch((function(e){return console.log(e)}))},e.handleInputChange=function(t){var n=e.state.employeeList,r=t.target.value.toLowerCase(),c=n.filter((function(e){return e.name.first.toLowerCase().indexOf(r)>-1}));e.setState({employeeFilter:c})},e}return Object(j.a)(n,[{key:"componentDidMount",value:function(){var e=this;g().then((function(t){return e.setState({employeeList:t.data.results,employeeFilter:t.data.results})})).catch((function(e){return console.log(e)}))}},{key:"render",value:function(){return Object(r.jsxs)(b,{children:[Object(r.jsx)(m,{children:Object(r.jsx)(O,{size:"md-12",children:Object(r.jsx)(p,{heading:"Search",children:Object(r.jsx)(x,{employee:this.state.employeeList,handleInputChange:this.handleInputChange})})})}),Object(r.jsx)(m,{children:Object(r.jsx)(O,{size:"md-12",children:Object(r.jsx)(p,{children:Object(r.jsx)(f,{results:this.state.employeeFilter,sortEmByName:this.sortEmByName})})})})]})}}]),n}(c.Component);var C=function(){return Object(r.jsxs)("div",{className:"App",children:[Object(r.jsx)(u,{}),Object(r.jsx)(N,{}),Object(r.jsxs)("header",{className:"App-header",children:[Object(r.jsx)("img",{src:l,className:"App-logo",alt:"logo"}),Object(r.jsxs)("p",{children:["Edit ",Object(r.jsx)("code",{children:"src/App.js"})," and save to reload."]}),Object(r.jsx)("a",{className:"App-link",href:"https://reactjs.org",target:"_blank",rel:"noopener noreferrer",children:"Learn React"})]})]})},F=function(e){e&&e instanceof Function&&n.e(3).then(n.bind(null,47)).then((function(t){var n=t.getCLS,r=t.getFID,c=t.getFCP,s=t.getLCP,a=t.getTTFB;n(e),r(e),c(e),s(e),a(e)}))};i.a.render(Object(r.jsx)(s.a.StrictMode,{children:Object(r.jsx)(C,{})}),document.getElementById("root")),F()}},[[46,1,2]]]);
  //# sourceMappingURL=main.9ab10f46.chunk.js.map