This file contains hidden or 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, { useState, useRef, useEffect, useLayoutEffect } from 'react'; | |
import { useViewportScroll, useTransform, motion } from 'framer-motion'; | |
const Parallax = ({ rangeX, rangeY, children, ...rest }) => { | |
const ref = useRef(); | |
const [rangeStart, setRangeStart] = useState(0); | |
const [rangeEnd, setRangeEnd] = useState(0); | |
const { scrollY } = useViewportScroll(); |
This file contains hidden or 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 * as React from "react" | |
import { PropertyControls, ControlType, Frame } from "framer" | |
import { ThemeWrap } from "./ThemeWrap" | |
import { Heading as HeadingPrimitive, Box } from "@modulz/radix" | |
interface Props { | |
xray: Boolean | |
text: string | |
textColor: |
This file contains hidden or 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
// .filter(Boolean) | |
// .fitler to unique values | |
const fruit = ['Apple', 'Banana', 'Apple', 'Orange'] | |
console.log(Array.from(new Set(fruit))) | |
const unique = (element, index, fullArray) => fullArray.indexOf(element) === index | |
console.log(fruit.filter(unique)) | |
/* |
This file contains hidden or 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
/** | |
* Copyright 2014 Google Inc. All rights reserved. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains hidden or 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, { Component } from 'react'; | |
import { debounce } from 'throttle-debounce'; | |
export default function (ComposedComponent) { | |
class WithSize extends Component { | |
static getDomNodeDimensions(node) { | |
const { | |
top, right, bottom, left, width, height, | |
} = node.getBoundingClientRect(); | |
return { |
This file contains hidden or 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 from 'react'; | |
import ReactDOM from 'react-dom'; | |
import styled, { ThemeProvider } from 'styled-components'; | |
// Define theme constants | |
const theme = { | |
titleFontSize : '24px', | |
titleFontSizeMD : '32px' | |
}; |
This file contains hidden or 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
// use Prompt like normal... magic happens in getUserConfirmation | |
class App extends Component { | |
render () { | |
return ( | |
<Router getUserConfirmation={getUserConfirmation}> | |
{...} | |
<Prompt | |
when={formIsHalfFilledOut} | |
message="Are you sure you want to leave?" | |
/> |
NewerOlder