parent
88bda6bcb6
commit
3a50152b21
@ -0,0 +1,3 @@
|
||||
.dateIcon {
|
||||
padding-right: 15px;
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import { icons } from 'Helpers/Props';
|
||||
import Icon from 'Components/Icon';
|
||||
import getRelativeDate from 'Utilities/Date/getRelativeDate';
|
||||
import styles from './MovieReleaseDates.css';
|
||||
|
||||
function MovieReleaseDates(props) {
|
||||
const {
|
||||
showRelativeDates,
|
||||
shortDateFormat,
|
||||
timeFormat,
|
||||
inCinemas,
|
||||
physicalRelease,
|
||||
digitalRelease
|
||||
} = props;
|
||||
|
||||
return (
|
||||
<div>
|
||||
{
|
||||
!!inCinemas &&
|
||||
<div >
|
||||
<span className={styles.dateIcon}>
|
||||
<Icon
|
||||
name={icons.IN_CINEMAS}
|
||||
/>
|
||||
</span>
|
||||
{getRelativeDate(inCinemas, shortDateFormat, showRelativeDates, { timeFormat, timeForToday: false })}
|
||||
</div>
|
||||
}
|
||||
{
|
||||
!!physicalRelease &&
|
||||
<div >
|
||||
<span className={styles.dateIcon}>
|
||||
<Icon
|
||||
name={icons.DISC}
|
||||
/>
|
||||
</span>
|
||||
{getRelativeDate(physicalRelease, shortDateFormat, showRelativeDates, { timeFormat, timeForToday: false })}
|
||||
</div>
|
||||
}
|
||||
|
||||
{
|
||||
!!digitalRelease &&
|
||||
<div >
|
||||
<span className={styles.dateIcon}>
|
||||
<Icon
|
||||
name={icons.MOVIE_FILE}
|
||||
/>
|
||||
</span>
|
||||
{getRelativeDate(digitalRelease, shortDateFormat, showRelativeDates, { timeFormat, timeForToday: false })}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
MovieReleaseDates.propTypes = {
|
||||
showRelativeDates: PropTypes.bool.isRequired,
|
||||
shortDateFormat: PropTypes.string.isRequired,
|
||||
longDateFormat: PropTypes.string.isRequired,
|
||||
timeFormat: PropTypes.string.isRequired,
|
||||
inCinemas: PropTypes.string,
|
||||
physicalRelease: PropTypes.string,
|
||||
digitalRelease: PropTypes.string
|
||||
};
|
||||
|
||||
export default MovieReleaseDates;
|
@ -0,0 +1,21 @@
|
||||
import _ from 'lodash';
|
||||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
||||
import MovieReleaseDates from './MovieReleaseDates';
|
||||
|
||||
function createMapStateToProps() {
|
||||
return createSelector(
|
||||
createUISettingsSelector(),
|
||||
(uiSettings) => {
|
||||
return _.pick(uiSettings, [
|
||||
'showRelativeDates',
|
||||
'shortDateFormat',
|
||||
'longDateFormat',
|
||||
'timeFormat'
|
||||
]);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(createMapStateToProps, null)(MovieReleaseDates);
|
Loading…
Reference in new issue