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
const DATA_ATTRIBUTE_INDEX = 'data-focus-index' | |
const DATA_ATTRIBUTE_SKIP = 'data-focus-skip' | |
const focusableElements = [ | |
'a[href]', | |
'area[href]', | |
'button:not([disabled])', | |
'embed', | |
'iframe', | |
'input:not([disabled])', |
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
function createScrollFrame({ | |
scrollPosition = window.pageYOffset, | |
triggerSize = window.innerHeight, | |
triggerOrigin = 0, | |
startElement, | |
startOrigin = 0, | |
startOffset = 0, | |
endElement, | |
endOrigin = 1, | |
endOffset = 0, |
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
<Resize> | |
{ ({ bindElement, contentRects }) => | |
<div {...bindElement({ id: 1, onResize: contentRect => console.log(contentRect) })}> | |
{contentRects['1']} | |
</div> | |
} | |
</Resize> |
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 Collapse from './components/Collapse' | |
import OverflowMenu from './components/OverflowMenu' | |
import Popover from './components/Popover' | |
import Table from './components/Table' | |
import ResizeObserver from 'resize-observer-polyfill' | |
import createReactContext from 'create-react-context' |
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
class App extends React.Component { | |
render() { | |
const columns = [ | |
{ | |
header: '', | |
cell: 'id', | |
}, | |
{ | |
header: 'First Name', | |
cell: 'firstName', |
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
function shallowEqual(a, b) { | |
return JSON.stringify(a) === JSON.stringify(b) | |
} | |
function toggleValue(value, item) { | |
let previousValue = false | |
const newValue = value.reduce((values, value) => { | |
if (shallowEqual(item, value)) { | |
previousValue = true | |
return values |
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 AnimatedValue from '../../AnimatedValue' | |
const check = value => value === 'auto' | |
const convert = (acc, [name, value]) => ({ | |
...acc, | |
[name]: new AnimatedValue(value), | |
}) |
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
/** | |
* Used to clone and apply props to children | |
*/ | |
function cloneChildren(children, callback) { | |
const childrenArray = React.Children.toArray(children).filter( | |
child => child !== undefined && child !== null && child !== false | |
) | |
const childrenCount = childrenArray.length | |
return childrenArray.map( | |
(child, index) => |
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 request from 'request' | |
const api_endpoint = 'https://api.figma.com/v1' | |
const personal_access_token = 'FIGMA_ACCESS_TOKEN_HERE' // https://www.figma.com/developers/docs#auth-dev-token | |
function downloadSvgFromAWS(url) { | |
return new Promise((resolve, reject) => { | |
request.get( | |
url, | |
{ |