This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"scripts": { | |
"e2e:staging": "yarn run $(grep API_KEY .env | cut -d '=' -f2)", | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const preloadLazy = (dynamicImport) => { | |
let promise; | |
function load() { | |
if(!promise) { | |
promise = dynamicImport(); | |
} | |
return promise; | |
} | |
const component = React.lazy(load); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const preloadImage = (url: string) => { | |
return new Promise(resolve => { | |
const img = document.createElement('img'); | |
img.src = url; | |
img.onload = () => resolve(src); | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { PureComponent, ReactNode } from 'react'; | |
const isBrowser = () => typeof window !== 'undefined' && typeof document !== 'undefined'; | |
const shouldPolyfillIntersectionObserver = () => | |
isBrowser() && | |
!( | |
'IntersectionObserver' in window && | |
'IntersectionObserverEntry' in window && | |
'intersectionRatio' in IntersectionObserverEntry.prototype |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const svg = document.querySelector("svg"); | |
const bbox = svg.getBBox(); | |
svg.setAttribute("viewBox", [bbox.x, bbox.y, bbox.width, bbox.height].join(" ")); | |
console.log(svg.outerHTML); |
NewerOlder