backpack-ui
Version:
Lonely Planet's Components
19 lines (14 loc) • 509 B
JavaScript
/* eslint-disable */
// https://github.com/souporserious/react-motion-ui-pack/blob/master/src/to-RM-styles.js
import { spring } from 'react-motion'
export default function toRMStyles(styles) {
const rmStyles = {}
Object.keys(styles).forEach(key => {
const style = styles[key]
const isObject = (typeof style === 'object')
// check if user passed their own config
// if not default to a regular spring
rmStyles[key] = isObject ? { ...style } : spring(style)
})
return rmStyles
}