-
Notifications
You must be signed in to change notification settings - Fork 22
Free Listings + Paid Ads: Add the boost product listings section #1649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
eason9487
merged 3 commits into
feature/1610-streamlined-onboarding
from
add/1610-paid-ads-features-section
Aug 30, 2022
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
.gla-step-content-footer { | ||
display: flex; | ||
justify-content: flex-end; | ||
|
||
&[hidden] { | ||
display: none; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
141 changes: 141 additions & 0 deletions
141
js/src/setup-mc/setup-stepper/setup-paid-ads/paid-ads-features-section.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
import { Flex, FlexItem, FlexBlock } from '@wordpress/components'; | ||
import { Pill } from '@woocommerce/components'; | ||
import GridiconCheckmark from 'gridicons/dist/checkmark'; | ||
import GridiconGift from 'gridicons/dist/gift'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import Section from '.~/wcdl/section'; | ||
import AppDocumentationLink from '.~/components/app-documentation-link'; | ||
import './paid-ads-features-section.scss'; | ||
|
||
function FeatureList() { | ||
const featuresItems = [ | ||
{ | ||
Icon: GridiconCheckmark, | ||
content: __( | ||
'Promote your products across Google Search, YouTube, Display, Discover, Maps, Gmail, and more.', | ||
'google-listings-and-ads' | ||
), | ||
}, | ||
{ | ||
Icon: GridiconCheckmark, | ||
content: __( | ||
'Set a daily budget, and only pay when someone clicks.', | ||
'google-listings-and-ads' | ||
), | ||
}, | ||
{ | ||
Icon: GridiconGift, | ||
content: __( | ||
'Claim $500 in ads credit when you spend your first $500 with Google Ads. Terms and conditions apply.', | ||
'google-listings-and-ads' | ||
), | ||
}, | ||
]; | ||
|
||
return ( | ||
<div className="gla-paid-ads-features-section__feature-list"> | ||
{ featuresItems.map( ( { Icon, content }, idx ) => ( | ||
<Flex key={ idx } align="flex-start"> | ||
<Icon size="18" /> | ||
<FlexBlock>{ content }</FlexBlock> | ||
</Flex> | ||
) ) } | ||
</div> | ||
); | ||
} | ||
|
||
// TODO: `href` is not yet ready. Will be added later. | ||
/** | ||
* @fires gla_documentation_link_click with `{ context: 'setup-paid-ads', link_id: 'paid-ads-with-performance-max-campaigns-learn-more', href: 'https://example.com' }` | ||
*/ | ||
|
||
/** | ||
* Renders a section layout to elaborate on the features of paid ads and show the buttons | ||
* for the next actions: skip or continue the paid ads setup. | ||
* | ||
* @param {Object} props React props. | ||
* @param {boolean} props.hideFooterButtons Whether to hide the buttons at the card footer. | ||
* @param {JSX.Element} props.skipButton Button to skip paid ads setup. | ||
* @param {JSX.Element} props.continueButton Button to continue paid ads setup. | ||
*/ | ||
export default function PaidAdsFeaturesSection( { | ||
hideFooterButtons, | ||
skipButton, | ||
continueButton, | ||
} ) { | ||
return ( | ||
<Section | ||
className="gla-paid-ads-features-section" | ||
topContent={ | ||
<Pill>{ __( 'Recommended', 'google-listings-and-ads' ) }</Pill> | ||
} | ||
title={ __( | ||
'Boost product listings with paid ads', | ||
'google-listings-and-ads' | ||
) } | ||
description={ | ||
<> | ||
<p> | ||
{ __( | ||
'Get the most out of your paid ads with Performance Max campaigns. With Google’s machine learning technology, your Performance Max campaigns will be automated to show the most impactful ads at the right time and place.', | ||
'google-listings-and-ads' | ||
) } | ||
</p> | ||
<p> | ||
<AppDocumentationLink | ||
context="setup-paid-ads" | ||
linkId="paid-ads-with-performance-max-campaigns-learn-more" | ||
href="https://example.com" // TODO: Not yet ready. Will be added later. | ||
> | ||
{ __( 'Learn more', 'google-listings-and-ads' ) } | ||
</AppDocumentationLink> | ||
</p> | ||
</> | ||
} | ||
> | ||
<Section.Card> | ||
<Section.Card.Body> | ||
<Flex align="center" gap={ 9 }> | ||
<FlexBlock> | ||
<Section.Card.Title> | ||
{ __( | ||
'Drive more traffic and sales by using both free listings and paid ads', | ||
'google-listings-and-ads' | ||
) } | ||
</Section.Card.Title> | ||
<div className="gla-paid-ads-features-section__subtitle"> | ||
{ __( | ||
'Using free listings and paid ads together can double impressions and increase clicks by 50%*', | ||
'google-listings-and-ads' | ||
) } | ||
</div> | ||
<FeatureList /> | ||
<cite className="gla-paid-ads-features-section__cite"> | ||
{ __( | ||
'Source: Google Internal Data, July 2020', | ||
'google-listings-and-ads' | ||
) } | ||
</cite> | ||
</FlexBlock> | ||
<FlexItem> | ||
<div style={ { width: '205px' } }> | ||
Will be added by another PR | ||
</div> | ||
</FlexItem> | ||
</Flex> | ||
</Section.Card.Body> | ||
<Section.Card.Footer hidden={ hideFooterButtons }> | ||
{ skipButton } | ||
{ continueButton } | ||
</Section.Card.Footer> | ||
</Section.Card> | ||
</Section> | ||
); | ||
} |
38 changes: 38 additions & 0 deletions
38
js/src/setup-mc/setup-stepper/setup-paid-ads/paid-ads-features-section.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
.gla-paid-ads-features-section { | ||
.woocommerce-pill { | ||
color: $gray-700; | ||
} | ||
|
||
.wcdl-section-card-title { | ||
margin-bottom: $grid-unit-15; | ||
line-height: $gla-line-height-medium-large; | ||
font-weight: normal; | ||
font-size: $gla-font-small-medium; | ||
color: $gray-900; | ||
} | ||
|
||
&__subtitle { | ||
line-height: $gla-line-height-medium; | ||
font-size: $gla-font-small; | ||
color: $gray-800; | ||
} | ||
|
||
&__feature-list { | ||
display: flex; | ||
flex-direction: column; | ||
gap: $grid-unit-20; | ||
margin: $grid-unit-30 0 $grid-unit-20; | ||
line-height: $gla-line-height-smaller; | ||
color: $gray-800; | ||
|
||
.gridicon { | ||
fill: #5ec862; | ||
} | ||
} | ||
|
||
&__cite { | ||
font-style: normal; | ||
font-size: $gla-font-smaller; | ||
color: $gray-600; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,13 +17,15 @@ import StepContentFooter from '.~/components/stepper/step-content-footer'; | |
import FaqsSection from '.~/components/paid-ads/faqs-section'; | ||
import AppButton from '.~/components/app-button'; | ||
import ProductFeedStatusSection from './product-feed-status-section'; | ||
import PaidAdsFeaturesSection from './paid-ads-features-section'; | ||
import { getProductFeedUrl } from '.~/utils/urls'; | ||
import { GUIDE_NAMES } from '.~/constants'; | ||
import { API_NAMESPACE } from '.~/data/constants'; | ||
|
||
export default function SetupPaidAds() { | ||
const adminUrl = useAdminUrl(); | ||
const { createNotice } = useDispatchCoreNotices(); | ||
const [ showPaidAdsSetup, setShowPaidAdsSetup ] = useState( false ); | ||
const [ completing, setCompleting ] = useState( null ); | ||
|
||
const finishFreeListingsSetup = async ( event ) => { | ||
|
@@ -56,6 +58,19 @@ export default function SetupPaidAds() { | |
await finishFreeListingsSetup( event ); | ||
}; | ||
|
||
function createSkipButton( text ) { | ||
return ( | ||
<AppButton | ||
isTertiary | ||
data-action="skip-ads" | ||
text={ text } | ||
loading={ completing === 'skip-ads' } | ||
disabled={ completing === 'complete-ads' } | ||
Comment on lines
+67
to
+68
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💅 WDYT about using some constants here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
onClick={ finishFreeListingsSetup } | ||
/> | ||
); | ||
} | ||
|
||
return ( | ||
<StepContent> | ||
<StepContentHeader | ||
|
@@ -69,30 +84,43 @@ export default function SetupPaidAds() { | |
) } | ||
/> | ||
<ProductFeedStatusSection /> | ||
<PaidAdsFeaturesSection | ||
hideFooterButtons={ showPaidAdsSetup } | ||
skipButton={ createSkipButton( | ||
__( 'Skip this step for now', 'google-listings-and-ads' ) | ||
) } | ||
continueButton={ | ||
<AppButton | ||
isPrimary | ||
text={ __( | ||
'Create a paid ad campaign', | ||
'google-listings-and-ads' | ||
) } | ||
disabled={ completing === 'skip-ads' } | ||
onClick={ () => setShowPaidAdsSetup( true ) } | ||
/> | ||
} | ||
/> | ||
<FaqsSection /> | ||
<StepContentFooter> | ||
<StepContentFooter hidden={ ! showPaidAdsSetup }> | ||
<Flex justify="right" gap={ 4 }> | ||
<AppButton | ||
isTertiary | ||
data-action="skip-ads" | ||
loading={ completing === 'skip-ads' } | ||
disabled={ completing === 'complete-ads' } | ||
onClick={ finishFreeListingsSetup } | ||
> | ||
{ __( | ||
{ createSkipButton( | ||
__( | ||
'Skip paid ads creation', | ||
'google-listings-and-ads' | ||
) } | ||
</AppButton> | ||
) | ||
) } | ||
<AppButton | ||
isPrimary | ||
data-action="complete-ads" | ||
text={ __( | ||
'Complete setup', | ||
'google-listings-and-ads' | ||
) } | ||
loading={ completing === 'complete-ads' } | ||
disabled={ completing === 'skip-ads' } | ||
onClick={ handleCompleteClick } | ||
> | ||
{ __( 'Complete setup', 'google-listings-and-ads' ) } | ||
</AppButton> | ||
/> | ||
</Flex> | ||
</StepContentFooter> | ||
</StepContent> | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
.wcdl-section-card-footer { | ||
padding: calc(var(--large-gap) / 2) var(--large-gap); | ||
|
||
&[hidden] { | ||
display: none; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ | |
} | ||
|
||
p { | ||
margin: 0 0 1em; | ||
margin: 0 0 $grid-unit; | ||
line-height: $gla-line-height-smaller; | ||
} | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💅 Possible to divide the components in multiple files? 1 per component?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion. However, I lean toward keeping the component here because it is not used by others and it's a plain component.