-
Notifications
You must be signed in to change notification settings - Fork 0
/
component---cache-dev-404-page-js-d1cbb9062e161188f32e.js
2 lines (2 loc) · 3.42 KB
/
component---cache-dev-404-page-js-d1cbb9062e161188f32e.js
1
2
(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{wWfg:function(t,e,a){"use strict";a.r(e),a.d(e,"pagesQuery",(function(){return l}));a("XfO3"),a("HEwt"),a("a1Th"),a("Btvt"),a("rE2o"),a("ioFf"),a("rGqo"),a("Oyvg");var n=a("q1tI"),r=a.n(n),s=a("Wbzz"),c=a("qKvR");function o(t){return function(t){if(Array.isArray(t)){for(var e=0,a=new Array(t.length);e<t.length;e++)a[e]=t[e];return a}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function h(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var i=function(t){var e,a;function n(e){var a,n=(a=t.call(this,e)||this).props.data.allSitePage.nodes.map((function(t){return t.path}));return a.state={showCustom404:!1,initPagePaths:n,pagePaths:n,pagePathSearchTerms:""},a.showCustom404=a.showCustom404.bind(h(a)),a.handlePagePathSearch=a.handlePagePathSearch.bind(h(a)),a.handleSearchTermChange=a.handleSearchTermChange.bind(h(a)),a}a=t,(e=n).prototype=Object.create(a.prototype),e.prototype.constructor=e,e.__proto__=a;var r=n.prototype;return r.showCustom404=function(){this.setState({showCustom404:!0})},r.handleSearchTermChange=function(t){this.setState({pagePathSearchTerms:t.target.value})},r.handlePagePathSearch=function(t){t.preventDefault();var e=o(this.state.initPagePaths),a=new RegExp(""+this.state.pagePathSearchTerms);this.setState({pagePaths:e.filter((function(t){return a.test(t)}))})},r.render=function(){var t,e=this.props.location.pathname;return t="/"===e?"src/pages/index.js":"/"===e.slice(-1)?"src/pages"+e.slice(0,-1)+".js":"src/pages"+e+".js",this.state.showCustom404?this.props.custom404:Object(c.c)("div",null,Object(c.c)("h1",null,"Gatsby.js development 404 page"),Object(c.c)("p",null,"There's not a page yet at ",Object(c.c)("code",null,e)),this.props.custom404?Object(c.c)("p",null,Object(c.c)("button",{onClick:this.showCustom404},"Preview custom 404 page")):Object(c.c)("p",null,"A custom 404 page wasn't detected - if you would like to add one, create a component in your site directory at ",Object(c.c)("code",null,"src/pages/404.js"),"."),Object(c.c)("p",null,"Create a React.js component in your site directory at"," ",Object(c.c)("code",null,t)," ","and this page will automatically refresh to show the new page component you created."),this.state.initPagePaths.length>0&&Object(c.c)("div",null,Object(c.c)("p",null,"If you were trying to reach another page, perhaps you can find it below."),Object(c.c)("h2",null,"Pages (",this.state.pagePaths.length!=this.state.initPagePaths.length?this.state.pagePaths.length+"/"+this.state.initPagePaths.length:this.state.initPagePaths.length,")"),Object(c.c)("form",{onSubmit:this.handlePagePathSearch},Object(c.c)("label",null,"Search:",Object(c.c)("input",{type:"text",id:"search",placeholder:"Search pages...",value:this.state.pagePathSearchTerms,onChange:this.handleSearchTermChange})),Object(c.c)("input",{type:"submit",value:"Submit"})),Object(c.c)("ul",null,this.state.pagePaths.map((function(t,e){return e<100&&Object(c.c)("li",{key:t},Object(c.c)(s.a,{to:t},t))})),this.state.pagePaths.length>100&&Object(c.c)("p",{style:{fontWeight:"bold"}},"... and ",this.state.pagePaths.length-100," more."))))},n}(r.a.Component);e.default=i;var l="2363535085"}}]);
//# sourceMappingURL=component---cache-dev-404-page-js-d1cbb9062e161188f32e.js.map