Get a single post from an array of objects
const i = this.props.posts.findIndex((post) => post.code === postId);
const post = this.props.posts[i];
Use destructuring to re-assign two variables
| Spaceport - http://spaceportx.com | |
| Escalator - http://theescalator.com | |
| Hello Hub - http://hellowork.co.uk | |
| The Assembly - http://assemblymcr.com | |
| MadLab - http://madlab.org.uk | |
| Metro Desk - http://metrodesk.com | |
| Work Space - http://work-space.co.uk | |
| Colony Co - http://colonyco.work |
| ///* ======================================================================== | |
| // #Z-INDEX | |
| // ======================================================================== */ | |
| $z-index-map: ( | |
| 'far-background': -20, | |
| 'background': -10, | |
| 'middle': 0, | |
| 'forground': 10, | |
| 'near-foreground': 20 |
| // a good way to get by having `.grey-light` `.grey-lighter` variable names | |
| $colour-map-grey: ( | |
| 1000: hsl(0, 0%, 10%), // #1A1A1A | |
| 1500: hsl(0, 0%, 14%), // #232323 | |
| 2000: hsl(0, 0%, 20%), // #333333 | |
| 2500: hsl(0, 0%, 33%), // #545454 | |
| 3000: hsl(0, 0%, 40%), // #6e6e6e | |
| 5000: hsl(0, 0%, 80%), // #cccccc | |
| 7000: hsl(0, 0%, 96%), // #eeeeee |
| /*SINE*/ | |
| $easeInSine: cubic-bezier(0.47, 0, 0.745, 0.715); | |
| $easeOutSine: cubic-bezier(0.39, 0.575, 0.565, 1); | |
| $easeInOutSine: cubic-bezier(0.445, 0.05, 0.55, 0.95); | |
| /*QUAD*/ | |
| $easeInQuad: cubic-bezier(0.55, 0.085, 0.68, 0.53); | |
| $easeOutQuad: cubic-bezier(0.25, 0.46, 0.45, 0.94); | |
| $easeInOutQuad: cubic-bezier(0.455, 0.03, 0.515, 0.955); |
| export function slugify(text) { | |
| return text.toString().toLowerCase() | |
| .replace(/\s+/g, '-') // Replace spaces with - | |
| .replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
| .replace(/\-\-+/g, '-') // Replace multiple - with single - | |
| .replace(/^-+/, '') // Trim - from start of text | |
| .replace(/-+$/, ''); // Trim - from end of text | |
| } |
| const webpack = require('webpack'); | |
| const nodeEnv = process.env.NODE_ENV || 'production'; | |
| module.exports = { | |
| devtool: 'source-map', | |
| entry: { | |
| filename: './app.js' | |
| }, | |
| output: { | |
| filename: '_build/bundle.js' |