Pull reduceMotion from Redux store
This commit is contained in:
parent
f451b81e25
commit
c5886508eb
|
@ -1,5 +1,20 @@
|
|||
import { reduceMotion } from '../../../initial_state';
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import ReducedMotion from './reduced_motion';
|
||||
import Motion from 'react-motion/lib/Motion';
|
||||
import { getSettings } from 'soapbox/actions/settings';
|
||||
|
||||
export default reduceMotion ? ReducedMotion : Motion;
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue