-
Notifications
You must be signed in to change notification settings - Fork 2.8k
/
index.js
36 lines (32 loc) · 1.06 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import React from 'react';
import PropTypes from 'prop-types';
import MobileBackgroundImage from '../../../../../assets/images/home-background--mobile.svg';
import DesktopBackgroundImage from '../../../../../assets/images/home-background--desktop.svg';
const defaultProps = {
isSmallScreen: false,
style: [],
};
const propTypes = {
isSmallScreen: PropTypes.bool,
pointerEvents: PropTypes.string.isRequired,
width: PropTypes.number.isRequired,
style: PropTypes.oneOfType([PropTypes.object, PropTypes.arrayOf(PropTypes.object)]),
};
function BackgroundImage(props) {
return props.isSmallScreen ? (
<MobileBackgroundImage
pointerEvents={props.pointerEvents}
width={props.width}
style={props.style}
/>
) : (
<DesktopBackgroundImage
pointerEvents={props.pointerEvents}
width={props.width}
/>
);
}
BackgroundImage.displayName = 'BackgroundImage';
BackgroundImage.propTypes = propTypes;
BackgroundImage.defaultProps = defaultProps;
export default BackgroundImage;