diff --git a/projects/plugins/jetpack/_inc/client/my-plan/index.jsx b/projects/plugins/jetpack/_inc/client/my-plan/index.jsx index 333d58c301772..e989ab86fe39f 100644 --- a/projects/plugins/jetpack/_inc/client/my-plan/index.jsx +++ b/projects/plugins/jetpack/_inc/client/my-plan/index.jsx @@ -20,6 +20,7 @@ import { getSiteConnectionStatus } from 'state/connection'; import MyPlanHeader from './my-plan-header'; import MyPlanBody from './my-plan-body'; +import MyPlanPartnerCoupon from './my-plan-partner-coupon'; export function MyPlan( props ) { let sitePlan = props.sitePlan.product_slug || '', @@ -34,6 +35,7 @@ export function MyPlan( props ) { return ( + { + const { productSlug, action, title, tagLine, trackingId } = props; + + useEffect( () => { + analytics.tracks.recordEvent( 'jetpack_my_plan_banner_view', { + type: trackingId, + } ); + }, [ trackingId ] ); + + const trackActionClick = useCallback( () => { + analytics.tracks.recordJetpackClick( { + target: trackingId, + feature: 'my-plan-banner', + page: 'my-plan', + } ); + }, [ trackingId ] ); + + return ( +
+
+ +
+
+ ); +}; + +MyPlanBanner.propTypes = { + productSlug: PropTypes.string.isRequired, + trackingId: PropTypes.string.isRequired, + action: PropTypes.element.isRequired, + tagLine: PropTypes.oneOfType( [ PropTypes.string, PropTypes.node, PropTypes.element ] ), + title: PropTypes.oneOfType( [ PropTypes.string, PropTypes.node, PropTypes.element ] ), +}; + +export default MyPlanBanner; diff --git a/projects/plugins/jetpack/_inc/client/my-plan/my-plan-banner/style.scss b/projects/plugins/jetpack/_inc/client/my-plan/my-plan-banner/style.scss new file mode 100644 index 0000000000000..c1fdef1f7fc7d --- /dev/null +++ b/projects/plugins/jetpack/_inc/client/my-plan/my-plan-banner/style.scss @@ -0,0 +1,17 @@ +@import '../../scss/calypso-colors'; + +.jp-my-plan-banner__card { + background-color: $white; + background-position: 100%; + background-size: 50% 100%; + background-repeat: no-repeat; +} + +.jp-my-plan-banner .my-plan-card__icon { + margin-top: 8px; + margin-bottom: 8px; +} + +.jp-my-plan-banner .my-plan-card__header { + align-self: center; +} diff --git a/projects/plugins/jetpack/_inc/client/my-plan/my-plan-partner-coupon/index.jsx b/projects/plugins/jetpack/_inc/client/my-plan/my-plan-partner-coupon/index.jsx new file mode 100644 index 0000000000000..ec6d16f9523f3 --- /dev/null +++ b/projects/plugins/jetpack/_inc/client/my-plan/my-plan-partner-coupon/index.jsx @@ -0,0 +1,65 @@ +/** + * External dependencies + */ +import React from 'react'; +import { connect } from 'react-redux'; +import PropTypes from 'prop-types'; +import { getRedirectUrl } from '@automattic/jetpack-components'; +import { __, sprintf } from '@wordpress/i18n'; + +/** + * Internal dependencies + */ +import Button from 'components/button'; +import MyPlanBanner from '../my-plan-banner'; +import { getPartnerCoupon } from 'state/initial-state'; + +const MyPlanPartnerCoupon = ( { partnerCoupon, siteRawUrl } ) => { + if ( 'object' !== typeof partnerCoupon ) { + return null; + } + + const redeemButton = ( + + ); + + return ( + + ); +}; + +MyPlanPartnerCoupon.propTypes = { + partnerCoupon: PropTypes.oneOfType( [ PropTypes.object, PropTypes.bool ] ).isRequired, + siteRawUrl: PropTypes.string.isRequired, +}; + +export default connect( state => ( { + partnerCoupon: getPartnerCoupon( state ), +} ) )( MyPlanPartnerCoupon ); diff --git a/projects/plugins/jetpack/changelog/add-my-plans-partner-coupon-component b/projects/plugins/jetpack/changelog/add-my-plans-partner-coupon-component new file mode 100644 index 0000000000000..f6193e06d7f8d --- /dev/null +++ b/projects/plugins/jetpack/changelog/add-my-plans-partner-coupon-component @@ -0,0 +1,4 @@ +Significance: minor +Type: enhancement + +Added Jetpack Partner Coupon banner on My Plan page diff --git a/projects/plugins/jetpack/images/jetpack-banner-gradient.png b/projects/plugins/jetpack/images/jetpack-banner-gradient.png new file mode 100644 index 0000000000000..7f30bc0982f9b Binary files /dev/null and b/projects/plugins/jetpack/images/jetpack-banner-gradient.png differ