-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomponent---src-pages-frontend-index-js-23ac084001987024b372.js.map
1 lines (1 loc) · 5.13 KB
/
component---src-pages-frontend-index-js-23ac084001987024b372.js.map
1
{"version":3,"sources":["webpack:///./src/pages/frontend/index.js","webpack:///./src/utils/unwidow.js"],"names":["YearTitle","_ref","children","react__WEBPACK_IMPORTED_MODULE_1___default","a","createElement","className","styles","year","PostTitle","_ref2","propTypes","PropTypes","node","isRequired","BlogPage","title","useSiteMetadata","posts","_public_static_d_3609948944_json__WEBPACK_IMPORTED_MODULE_0__","data","allMarkdownRemark","edges","Fragment","react_helmet__WEBPACK_IMPORTED_MODULE_4___default","map","_ref3","index","YearComponent","fields","frontmatter","thisYear","post","width","gatsby__WEBPACK_IMPORTED_MODULE_3__","to","slug","unwidow","fontSize","lineHeight","mt","mb","description","str","clean","trim","replace","match","length","split","pop"],"mappings":"0MAOMA,EAAY,SAAAC,GAAA,IAAGC,EAAHD,EAAGC,SAAH,OAChBC,EAAAC,EAAAC,cAAA,OAAKC,UAAWC,IAAOC,MAAON,IAE1BO,EAAY,SAAAC,GAAA,IAAGR,EAAHQ,EAAGR,SAAH,OAAkBC,EAAAC,EAAAC,cAAA,UAAKH,IAEzCO,EAAUE,UAAY,CACpBT,SAAUU,IAAUC,KAAKC,YAqEZC,UAlEE,WAAM,IACbC,EAAUC,cAAVD,MAoBFE,EAnBOC,EAAAC,KAmBMC,kBAAkBC,MACjCd,EAAO,IAEX,OACEL,EAAAC,EAAAC,cAAAF,EAAAC,EAAAmB,SAAA,KACEpB,EAAAC,EAAAC,cAACmB,EAAApB,EAAD,KACED,EAAAC,EAAAC,cAAA,uBAAeW,IAGjBb,EAAAC,EAAAC,cAAA,OAAKC,UAAWC,IAAOW,OACrBf,EAAAC,EAAAC,cAAA,eACEF,EAAAC,EAAAC,cAAA,YACGa,EAAMO,IAAI,SAAAC,EAAWC,GAAU,IAG1BC,EAHQf,EAAkBa,EAAlBb,KACJgB,EAAwBhB,EAAxBgB,OAAQC,EAAgBjB,EAAhBiB,YACVC,EAAWD,EAAYtB,KAQ7B,OALIuB,IAAavB,IACfoB,EAAgBzB,EAAAC,EAAAC,cAACL,EAAD,KAAY8B,EAAYtB,MACxCA,EAAOuB,GAIP5B,EAAAC,EAAAC,cAAA,OAAKC,UAAWC,IAAOyB,MACpBJ,EAEDzB,EAAAC,EAAAC,cAAA,OAAK4B,MAAO,CAAC,EAAG,KACd9B,EAAAC,EAAAC,cAACI,EAAD,KACEN,EAAAC,EAAAC,cAAC6B,EAAA,KAAD,CAAMC,GAAIN,EAAOO,MAAOC,YAAQP,EAAYd,SAG9Cb,EAAAC,EAAAC,cAAA,KAAGiC,SAAU,CAAC,EAAG,GAAIC,WAAW,OAAOC,GAAI,EAAGC,GAAI,GAC/CJ,YAAQP,EAAYY,6ECnD5BL,IAlBC,SAAAM,GAEd,IAAMC,EAAQD,EAAIE,OAAOC,QAAQ,OAAQ,KAKzC,OADcF,EAAMG,MAAM,QAAU,GAAGC,QAC3B,EAAUJ,EAGlBA,EAAMK,MAAM,KAAKC,MAAMF,OAAS,GAAWJ,EAKxCA,EAAME,QAAQ,oBAAqB","file":"component---src-pages-frontend-index-js-23ac084001987024b372.js","sourcesContent":["import React from 'react'\r\nimport PropTypes from 'prop-types'\r\nimport { Link, useStaticQuery, graphql } from 'gatsby'\r\nimport Helmet from 'react-helmet'\r\nimport { useSiteMetadata } from '../../utils/hooks'\r\nimport unwidow from '../../utils/unwidow'\r\nimport styles from './frontend.module.css'\r\nconst YearTitle = ({ children }) => (\r\n <div className={styles.year}>{children}</div>\r\n)\r\nconst PostTitle = ({ children }) => <h1>{children}</h1>\r\n\r\nPostTitle.propTypes = {\r\n children: PropTypes.node.isRequired,\r\n}\r\n\r\nconst BlogPage = () => {\r\n const { title } = useSiteMetadata()\r\n const data = useStaticQuery(graphql`\r\n query {\r\n allMarkdownRemark(sort: { order: DESC, fields: [frontmatter___date] }) {\r\n edges {\r\n node {\r\n frontmatter {\r\n title\r\n description\r\n year: date(formatString: \"YYYY\")\r\n }\r\n fields {\r\n slug\r\n }\r\n }\r\n }\r\n }\r\n }\r\n `)\r\n\r\n const posts = data.allMarkdownRemark.edges\r\n let year = '0'\r\n\r\n return (\r\n <>\r\n <Helmet>\r\n <title>Blog • {title}</title>\r\n </Helmet>\r\n\r\n <div className={styles.posts}>\r\n <article>\r\n <main>\r\n {posts.map(({ node }, index) => {\r\n const { fields, frontmatter } = node\r\n const thisYear = frontmatter.year\r\n let YearComponent\r\n\r\n if (thisYear !== year) {\r\n YearComponent = <YearTitle>{frontmatter.year}</YearTitle>\r\n year = thisYear\r\n }\r\n\r\n return (\r\n <div className={styles.post}>\r\n {YearComponent}\r\n\r\n <div width={[1, 4 / 5]}>\r\n <PostTitle>\r\n <Link to={fields.slug}>{unwidow(frontmatter.title)}</Link>\r\n </PostTitle>\r\n\r\n <p fontSize={[1, 2]} lineHeight=\"copy\" mt={3} mb={2}>\r\n {unwidow(frontmatter.description)}\r\n </p>\r\n </div>\r\n </div>\r\n )\r\n })}\r\n </main>\r\n </article>\r\n </div>\r\n </>\r\n )\r\n}\r\n\r\nexport default BlogPage\r\n","const unwidow = str => {\n // Remove extra whitespace characters before starting.\n const clean = str.trim().replace(/\\s+/g, ' ')\n\n // We only care about strings with at least 4 words, so if we don't find at\n // least 3 spaces in the string we can just return the cleaned up string.\n const count = clean.match(/\\s/g) || [].length\n if (count < 3) return clean\n\n // If the last word is long enough, just return the cleaned string.\n if (clean.split(' ').pop().length > 15) return clean\n\n // Regex matches the last instance of a whitespace character that is followed\n // by a non-whitespace character. It then replaces the former with a\n // non-breaking space character (\\u00A0).\n return clean.replace(/\\s+([\\S]*)(\\s*)$/g, '\\u00A0$1$2')\n}\n\nexport default unwidow\n"],"sourceRoot":""}