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 { BrowserRouter as Router, Switch, Route, Link } from 'react-router-dom' | |
| import { Motion } from 'data-driven-motion' | |
| const STIFF_SPRING = { stiffness: 420, damping: 42, precision: 0.1 } | |
| const BOUNCY_SPRING = { stiffness: 180, damping: 21, precision: 0.1 } | |
| const IMAGES = [ | |
| { id: 0, title: 'Dark Orchid', color: 'DarkOrchid' }, | |
| { id: 1, title: 'Lime Green', color: 'LimeGreen' }, |
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
| // tl;dr ...set the duration of a spring animation | |
| export const configw = (sec, overdamping) => { | |
| const s = overdamping <= 0 | |
| ? 1 - overdamping | |
| : 1 / Math.sqrt(1 + Math.pow(2 * Math.PI / Math.log(1 / (overdamping * overdamping)), 2)) | |
| const ks = (2 * Math.PI / sec) / Math.max(Math.sqrt(1 - s * s), 0.5) | |
| const c = 2 * ks * s | |
| return [ks * ks, c] |
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 { BrowserRouter as Router, Route, Link, Redirect, matchPath } from 'react-router-dom' | |
| import { Motion } from 'data-driven-motion' // https://github.com/tkh44/data-driven-motion | |
| const WOBBLY_SPRING = { stiffness: 200, damping: 15, precision: 0.1 } | |
| const AnimationExample = () => ( | |
| <Router> | |
| <div> | |
| <ul> |
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 { cloneElement, createElement as h, PropTypes, PureComponent } from 'react' | |
| import { TransitionMotion } from 'react-motion' | |
| export default class Eccentric extends PureComponent { | |
| static defaultProps = { | |
| component: h('div'), | |
| data: [] | |
| }; | |
| static propTypes = { |
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 { PureComponent, createElement as h, DOM } from 'react' | |
| import cn from 'classnames' | |
| import { StyleSheet, css } from 'aphrodite/no-important' | |
| import { colors, font } from 'style' | |
| import ClickOutside from 'ClickOutside' | |
| import Button from 'ui/Button' | |
| const { div, p } = DOM | |
| export default class Confirm extends PureComponent { |
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
| @mixin aspect-ratio($width, $height) { | |
| position: relative; | |
| &:before { | |
| display: block; | |
| content: " "; | |
| width: 100%; | |
| padding-top: ($height / $width) * 100%; | |
| } |
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
| // https://jsfiddle.net/tkh44/ub8s4deb/5/ | |
| const h = React.createElement | |
| const { branch, renderComponent } = Recompose | |
| const Box = (props) => { | |
| return h('pre', { style: { color: props.color, background: 'white', padding: 4 } }, | |
| `props: ${JSON.stringify(props, null, 2)}` | |
| ) | |
| } |
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 authDoor from 'hoc/auth-door' | |
| import Loadable from 'react-loadable'; | |
| import Loading from './Loading' | |
| const Dashboard = Loadable({ | |
| loader: () => import('pages/Dashboard'), | |
| LoadingComponent: Loading, | |
| // optional options... | |
| delay: 200, | |
| serverSideRequirePath: path.join(__dirname, 'pages/Dashboard'), |
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 { Component, DOM } from 'react' | |
| import { connect } from 'react-redux' | |
| import { colors } from 'style' | |
| const { div } = DOM | |
| const mapStateToProps = (state) => { | |
| const { connected, connecting } = state.nes | |
| return { connected, connecting } | |
| } |
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
| export const createApiAction = (actionType, request) => { | |
| const actionHandler = (...args) => { | |
| return (dispatch, getState) => { | |
| const { auth } = getState() | |
| const ticket = auth.user || auth.app | |
| return dispatch({ | |
| type: actionType, | |
| request: typeof request === 'function' ? request(...args) : request, | |
| meta: { |