export const scrollToTop = () => {
const c = document.documentElement.scrollTop || document.body.scrollTop;
if (c > 0) {
window.requestAnimationFrame(scrollToTop);
window.scrollTo(0, c - c / 8);
}
};
//export default createQueue = () => { //need static
function createQueue(){
//cache
//Private
const queue = [];
//Revealing Module Pattern
return {
enqueue(item) {
queue.unshift(item);
function slow(x) {
// there can be a heavy CPU-intensive job here
alert(`Called with ${x}`);
return x;
}
const flattenArr = (a) =>{
//return a reducer function
return a.reduce(function(acc, curr) {
//if current value is an array member,
Array.isArray(curr)
//push the value of the recursed function at the currentValue index and the rest of the array through destructuring
? acc.push(...flattenArr(curr))
//else, push the current value into the accumulator array
: acc.push(curr)
(from WesBos Advanced React and GraphQL course)[https://advancedreact.com/]
export default function(amount) {
const options = {
style: 'currency',
currency: 'USD',
minimumFractionDigits: 2,
};
// if its a whole, dollar amount, leave off the .00
if (amount % 100 === 0) options.minimumFractionDigits = 0;
import React from 'react'
import ReactDOM from 'react-dom'
const root = document.getElementById('root');
//need second div beside app 'root'
const modalRoot = document.getElementById('modal-root')
class Modal extends React.Component {
import React from 'react';
import Transition from 'react-transition-group/Transition';
//build config file to then expose interface controls on cms and grant ability to edit all animations from one dashboard
const duration = 400;
const duration2 = 800;
const defaultStyle = {
transition: `opacity ${duration2}ms ease-in-out, right ${duration}ms ease-in-out`,
String.prototype.toUpperCaseAll = function () {
return this.split(" ").map( w => w.charAt(0).toUpperCase() + w.substr(1, w.length-1)).join(" ");
};
NewerOlder