From 370edbdd4df7a9278b9fe6386c7b2bafbae4b34c Mon Sep 17 00:00:00 2001 From: VH Date: Thu, 7 Sep 2023 11:10:59 +0700 Subject: [PATCH 1/6] Fix android background image is missing --- .../BackgroundImage/index.android.js | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/pages/signin/SignInPageLayout/BackgroundImage/index.android.js b/src/pages/signin/SignInPageLayout/BackgroundImage/index.android.js index ee6a2f1aa418..c1761d344a30 100644 --- a/src/pages/signin/SignInPageLayout/BackgroundImage/index.android.js +++ b/src/pages/signin/SignInPageLayout/BackgroundImage/index.android.js @@ -1,3 +1,24 @@ -import backgroundImage from '../../../../../assets/images/home-background--android.svg'; +import React from 'react'; +import PropTypes from 'prop-types'; +import AndroidBackgroundImage from '../../../../../assets/images/home-background--android.svg'; +import styles from '../../../../styles/styles'; -export default backgroundImage; +const propTypes = { + pointerEvents: PropTypes.string.isRequired, + width: PropTypes.number.isRequired, +}; + +function BackgroundImage(props) { + return ( + + ) +} + +BackgroundImage.displayName = 'BackgroundImage'; +BackgroundImage.propTypes = propTypes; + +export default BackgroundImage; From 10c01c972452c1d66b7072cbf8c955e264365c9a Mon Sep 17 00:00:00 2001 From: VH Date: Thu, 7 Sep 2023 11:20:34 +0700 Subject: [PATCH 2/6] Fix linter --- .../signin/SignInPageLayout/BackgroundImage/index.android.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/signin/SignInPageLayout/BackgroundImage/index.android.js b/src/pages/signin/SignInPageLayout/BackgroundImage/index.android.js index c1761d344a30..4ea2dc5aa264 100644 --- a/src/pages/signin/SignInPageLayout/BackgroundImage/index.android.js +++ b/src/pages/signin/SignInPageLayout/BackgroundImage/index.android.js @@ -15,7 +15,7 @@ function BackgroundImage(props) { width={props.width} style={styles.signInBackground} /> - ) + ); } BackgroundImage.displayName = 'BackgroundImage'; From 93ea92620ab16e99dc239ac33789d91a24acc0d3 Mon Sep 17 00:00:00 2001 From: VH Date: Mon, 11 Sep 2023 18:23:51 +0700 Subject: [PATCH 3/6] Share default propTypes among platforms --- .../BackgroundImage/defaultPropTypes.js | 11 +++++++++++ .../SignInPageLayout/BackgroundImage/index.android.js | 9 ++------- .../signin/SignInPageLayout/BackgroundImage/index.js | 6 ++++-- 3 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 src/pages/signin/SignInPageLayout/BackgroundImage/defaultPropTypes.js diff --git a/src/pages/signin/SignInPageLayout/BackgroundImage/defaultPropTypes.js b/src/pages/signin/SignInPageLayout/BackgroundImage/defaultPropTypes.js new file mode 100644 index 000000000000..4c99055d4d51 --- /dev/null +++ b/src/pages/signin/SignInPageLayout/BackgroundImage/defaultPropTypes.js @@ -0,0 +1,11 @@ +import PropTypes from 'prop-types'; + +const defaultPropTypes = { + /** pointerEvents property to the SVG element */ + pointerEvents: PropTypes.string.isRequired, + + /** The width of the image. */ + width: PropTypes.number.isRequired, +}; + +export default defaultPropTypes; \ No newline at end of file diff --git a/src/pages/signin/SignInPageLayout/BackgroundImage/index.android.js b/src/pages/signin/SignInPageLayout/BackgroundImage/index.android.js index 4ea2dc5aa264..d8f59279ff1f 100644 --- a/src/pages/signin/SignInPageLayout/BackgroundImage/index.android.js +++ b/src/pages/signin/SignInPageLayout/BackgroundImage/index.android.js @@ -1,12 +1,7 @@ import React from 'react'; -import PropTypes from 'prop-types'; import AndroidBackgroundImage from '../../../../../assets/images/home-background--android.svg'; import styles from '../../../../styles/styles'; - -const propTypes = { - pointerEvents: PropTypes.string.isRequired, - width: PropTypes.number.isRequired, -}; +import defaultPropTypes from './defaultPropTypes'; function BackgroundImage(props) { return ( @@ -19,6 +14,6 @@ function BackgroundImage(props) { } BackgroundImage.displayName = 'BackgroundImage'; -BackgroundImage.propTypes = propTypes; +BackgroundImage.propTypes = defaultPropTypes; export default BackgroundImage; diff --git a/src/pages/signin/SignInPageLayout/BackgroundImage/index.js b/src/pages/signin/SignInPageLayout/BackgroundImage/index.js index d8c621509314..f02818d3043f 100644 --- a/src/pages/signin/SignInPageLayout/BackgroundImage/index.js +++ b/src/pages/signin/SignInPageLayout/BackgroundImage/index.js @@ -3,15 +3,17 @@ import PropTypes from 'prop-types'; import MobileBackgroundImage from '../../../../../assets/images/home-background--mobile.svg'; import DesktopBackgroundImage from '../../../../../assets/images/home-background--desktop.svg'; import styles from '../../../../styles/styles'; +import defaultPropTypes from './defaultPropTypes'; const defaultProps = { isSmallScreen: false, }; const propTypes = { + /** Is the window width narrow, like on a mobile device */ isSmallScreen: PropTypes.bool, - pointerEvents: PropTypes.string.isRequired, - width: PropTypes.number.isRequired, + + ...defaultPropTypes, }; function BackgroundImage(props) { return props.isSmallScreen ? ( From 5e7d8a87878e67d49def632d07bd31ed2f7fcdc0 Mon Sep 17 00:00:00 2001 From: VH Date: Mon, 11 Sep 2023 18:25:09 +0700 Subject: [PATCH 4/6] Add missing empty line --- .../signin/SignInPageLayout/BackgroundImage/defaultPropTypes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/signin/SignInPageLayout/BackgroundImage/defaultPropTypes.js b/src/pages/signin/SignInPageLayout/BackgroundImage/defaultPropTypes.js index 4c99055d4d51..1954fe84aa29 100644 --- a/src/pages/signin/SignInPageLayout/BackgroundImage/defaultPropTypes.js +++ b/src/pages/signin/SignInPageLayout/BackgroundImage/defaultPropTypes.js @@ -8,4 +8,4 @@ const defaultPropTypes = { width: PropTypes.number.isRequired, }; -export default defaultPropTypes; \ No newline at end of file +export default defaultPropTypes; From 785cc200b7122f0dd173e9935d0a92835266c3b4 Mon Sep 17 00:00:00 2001 From: VH Date: Mon, 11 Sep 2023 20:20:46 +0700 Subject: [PATCH 5/6] Fix linter --- .../signin/SignInPageLayout/BackgroundImage/defaultPropTypes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/signin/SignInPageLayout/BackgroundImage/defaultPropTypes.js b/src/pages/signin/SignInPageLayout/BackgroundImage/defaultPropTypes.js index 1954fe84aa29..0f3292ce00e2 100644 --- a/src/pages/signin/SignInPageLayout/BackgroundImage/defaultPropTypes.js +++ b/src/pages/signin/SignInPageLayout/BackgroundImage/defaultPropTypes.js @@ -1,7 +1,7 @@ import PropTypes from 'prop-types'; const defaultPropTypes = { - /** pointerEvents property to the SVG element */ + /** pointerEvents property to the SVG element */ pointerEvents: PropTypes.string.isRequired, /** The width of the image. */ From deef0ffb06f19dd3e5bb6a3863af51e812199ecf Mon Sep 17 00:00:00 2001 From: VH Date: Wed, 13 Sep 2023 10:04:15 +0700 Subject: [PATCH 6/6] rename to propTypes --- .../signin/SignInPageLayout/BackgroundImage/index.android.js | 2 +- src/pages/signin/SignInPageLayout/BackgroundImage/index.js | 2 +- .../BackgroundImage/{defaultPropTypes.js => propTypes.js} | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) rename src/pages/signin/SignInPageLayout/BackgroundImage/{defaultPropTypes.js => propTypes.js} (78%) diff --git a/src/pages/signin/SignInPageLayout/BackgroundImage/index.android.js b/src/pages/signin/SignInPageLayout/BackgroundImage/index.android.js index d8f59279ff1f..6ce60fc364fd 100644 --- a/src/pages/signin/SignInPageLayout/BackgroundImage/index.android.js +++ b/src/pages/signin/SignInPageLayout/BackgroundImage/index.android.js @@ -1,7 +1,7 @@ import React from 'react'; import AndroidBackgroundImage from '../../../../../assets/images/home-background--android.svg'; import styles from '../../../../styles/styles'; -import defaultPropTypes from './defaultPropTypes'; +import defaultPropTypes from './propTypes'; function BackgroundImage(props) { return ( diff --git a/src/pages/signin/SignInPageLayout/BackgroundImage/index.js b/src/pages/signin/SignInPageLayout/BackgroundImage/index.js index f02818d3043f..710f7b373a81 100644 --- a/src/pages/signin/SignInPageLayout/BackgroundImage/index.js +++ b/src/pages/signin/SignInPageLayout/BackgroundImage/index.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import MobileBackgroundImage from '../../../../../assets/images/home-background--mobile.svg'; import DesktopBackgroundImage from '../../../../../assets/images/home-background--desktop.svg'; import styles from '../../../../styles/styles'; -import defaultPropTypes from './defaultPropTypes'; +import defaultPropTypes from './propTypes'; const defaultProps = { isSmallScreen: false, diff --git a/src/pages/signin/SignInPageLayout/BackgroundImage/defaultPropTypes.js b/src/pages/signin/SignInPageLayout/BackgroundImage/propTypes.js similarity index 78% rename from src/pages/signin/SignInPageLayout/BackgroundImage/defaultPropTypes.js rename to src/pages/signin/SignInPageLayout/BackgroundImage/propTypes.js index 0f3292ce00e2..533d22ad12c5 100644 --- a/src/pages/signin/SignInPageLayout/BackgroundImage/defaultPropTypes.js +++ b/src/pages/signin/SignInPageLayout/BackgroundImage/propTypes.js @@ -1,6 +1,6 @@ import PropTypes from 'prop-types'; -const defaultPropTypes = { +const propTypes = { /** pointerEvents property to the SVG element */ pointerEvents: PropTypes.string.isRequired, @@ -8,4 +8,4 @@ const defaultPropTypes = { width: PropTypes.number.isRequired, }; -export default defaultPropTypes; +export default propTypes;