diff --git a/src/components/SVGImage/index.js b/src/components/SVGImage/index.js new file mode 100644 index 000000000000..ad957895b79d --- /dev/null +++ b/src/components/SVGImage/index.js @@ -0,0 +1,16 @@ +import React from 'react'; +import {Image} from 'react-native'; +import {getWidthAndHeightStyle} from '../../styles/styles'; +import propTypes from './propTypes'; + +const SVGImage = ({width, height, src}) => ( + +); + +SVGImage.propTypes = propTypes; +SVGImage.displayName = 'SVGImage'; + +export default SVGImage; diff --git a/src/components/SVGImage/index.native.js b/src/components/SVGImage/index.native.js new file mode 100644 index 000000000000..ca7df2868c49 --- /dev/null +++ b/src/components/SVGImage/index.native.js @@ -0,0 +1,16 @@ +import React from 'react'; +import {SvgCssUri} from 'react-native-svg'; +import propTypes from './propTypes'; + +const SVGImage = ({width, height, src}) => ( + +); + +SVGImage.propTypes = propTypes; +SVGImage.displayName = 'SVGImage'; + +export default SVGImage; diff --git a/src/components/SVGImage/propTypes.js b/src/components/SVGImage/propTypes.js new file mode 100644 index 000000000000..a98dab91eb64 --- /dev/null +++ b/src/components/SVGImage/propTypes.js @@ -0,0 +1,14 @@ +import PropTypes from 'prop-types'; + +const propTypes = { + /** The asset to render. */ + src: PropTypes.string.isRequired, + + /** The width of the image. */ + width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, + + /** The height of the image. */ + height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, +}; + +export default propTypes; diff --git a/src/pages/signin/SignInPageLayout/SignInPageLayoutWide.js b/src/pages/signin/SignInPageLayout/SignInPageLayoutWide.js index baa74be76aef..46909aef119e 100755 --- a/src/pages/signin/SignInPageLayout/SignInPageLayoutWide.js +++ b/src/pages/signin/SignInPageLayout/SignInPageLayoutWide.js @@ -1,8 +1,8 @@ import React from 'react'; import {View} from 'react-native'; import PropTypes from 'prop-types'; -import _ from 'underscore'; -import styles from '../../../styles/styles'; +import SVGImage from '../../../components/SVGImage'; +import styles, {getBackgroundColorStyle, getLoginPagePromoStyle} from '../../../styles/styles'; import ExpensifyCashLogo from '../../../components/ExpensifyCashLogo'; import Text from '../../../components/Text'; import variables from '../../../styles/variables'; @@ -26,12 +26,11 @@ const propTypes = { ...withLocalizePropTypes, }; -const backgroundStyles = [styles.backgroundBlue, styles.backgroundGreen, styles.backgroundOrange, styles.backgroundPink]; -const backgroundStyle = backgroundStyles[_.random(0, 3)]; +const backgroundStyle = getLoginPagePromoStyle(); const SignInPageLayoutWide = props => ( - + ( /> {props.shouldShowWelcomeText && ( - - {props.welcomeText} - + + {props.welcomeText} + )} {props.children} @@ -65,13 +64,16 @@ const SignInPageLayoutWide = props => ( + > + + ); diff --git a/src/styles/styles.js b/src/styles/styles.js index 28c057eff15a..3ab2f8965bc0 100644 --- a/src/styles/styles.js +++ b/src/styles/styles.js @@ -1,3 +1,4 @@ +import _ from 'underscore'; import fontFamily from './fontFamily'; import addOutlineWidth from './addOutlineWidth'; import themeColors from './themes/default'; @@ -174,30 +175,6 @@ const styles = { textTransform: 'uppercase', }, - background100: { - backgroundSize: '100% 100%', - }, - - backgroundGreen: { - backgroundColor: colors.green, - backgroundImage: `url(${CONST.CLOUDFRONT_URL}/images/homepage/brand-stories/freeplan_green.svg)`, - }, - - backgroundOrange: { - backgroundColor: colors.orange, - backgroundImage: `url(${CONST.CLOUDFRONT_URL}/images/homepage/brand-stories/freeplan_orange.svg)`, - }, - - backgroundPink: { - backgroundColor: colors.pink, - backgroundImage: `url(${CONST.CLOUDFRONT_URL}/images/homepage/brand-stories/freeplan_pink.svg)`, - }, - - backgroundBlue: { - backgroundColor: colors.blue, - backgroundImage: `url(${CONST.CLOUDFRONT_URL}/images/homepage/brand-stories/freeplan_blue.svg)`, - }, - colorReversed: { color: themeColors.textReversed, }, @@ -2462,6 +2439,33 @@ function getEmojiPickerStyle(isSmallScreenWidth) { }; } +/** + * Get the random promo color and image for Login page + * + * @return {Object} + */ +function getLoginPagePromoStyle() { + const promos = [ + { + backgroundColor: colors.green, + backgroundImageUri: `${CONST.CLOUDFRONT_URL}/images/homepage/brand-stories/freeplan_green.svg`, + }, + { + backgroundColor: colors.orange, + backgroundImageUri: `${CONST.CLOUDFRONT_URL}/images/homepage/brand-stories/freeplan_orange.svg`, + }, + { + backgroundColor: colors.pink, + backgroundImageUri: `${CONST.CLOUDFRONT_URL}/images/homepage/brand-stories/freeplan_pink.svg`, + }, + { + backgroundColor: colors.blue, + backgroundImageUri: `${CONST.CLOUDFRONT_URL}/images/homepage/brand-stories/freeplan_blue.svg`, + }, + ]; + return promos[_.random(0, 3)]; +} + export default styles; export { getSafeAreaPadding, @@ -2483,4 +2487,5 @@ export { getModalPaddingStyles, getFontFamilyMonospace, getEmojiPickerStyle, + getLoginPagePromoStyle, };