2020-05-28 18:50:53 -07:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { connect } from 'react-redux';
|
2020-03-27 13:59:38 -07:00
|
|
|
import ReducedMotion from './reduced_motion';
|
|
|
|
import Motion from 'react-motion/lib/Motion';
|
2020-05-28 18:50:53 -07:00
|
|
|
import { getSettings } from 'soapbox/actions/settings';
|
2020-03-27 13:59:38 -07:00
|
|
|
|
2020-05-28 18:50:53 -07:00
|
|
|
const mapStateToProps = state => ({
|
|
|
|
reduceMotion: getSettings(state).get('reduceMotion'),
|
|
|
|
});
|
|
|
|
|
|
|
|
const OptionalMotion = props => (
|
|
|
|
props.reduceMotion ? <ReducedMotion {...props} /> : <Motion {...props} />
|
|
|
|
);
|
|
|
|
|
|
|
|
OptionalMotion.propTypes = {
|
|
|
|
reduceMotion: PropTypes.bool,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default connect(mapStateToProps)(OptionalMotion);
|