-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add/new email comparison card props #58632
Add/new email comparison card props #58632
Conversation
Link to Calypso live: https://calypso.live?image=registry.a8c.com/calypso/app:build-21390 |
client/my-sites/email/email-providers-stacked-comparison/email-provider-stacked-card/index.tsx
Outdated
Show resolved
Hide resolved
const badge = <img src={ poweredByTitanLogo } alt={ translate( 'Powered by Titan' ) } />; | ||
const getTitanFeatures = () => { | ||
return [ | ||
translate( 'Inbox, calendars, and contacts' ), |
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.
ℹ️ String reuse speeds up translation and improves consistency. The following string might make a good alternative and has already been translated 20 times:
translate( 'Email, calendars, and contacts' )
ES Score: 6
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.
I have a bunch of comments from inspection. I'll loop back to test later this evening.
{ titleComponent && ( | ||
<> | ||
{ titleComponent } | ||
{ badge && <Badge className="promo-card__title-badge">{ badge }</Badge> } |
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.
Nit: it may be worth defining the badge wrapper once rather than repeating it.
const badgeComponent = badge ? <Badge className="promo-card__title-badge">{ badge }</Badge> : null;
and then refer to this component in the later code.
title?: string | TranslateResult; | ||
titleComponent?: ReactElement; | ||
isPrimary?: boolean; | ||
badge?: string; | ||
badge?: string | ReactElement; |
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.
It looks like some of these types are imported via import
instead of import type
.
@@ -1,14 +1,19 @@ | |||
import classnames from 'classnames'; | |||
import { useTranslate, TranslateResult } from 'i18n-calypso'; | |||
import { FunctionComponent } from 'react'; | |||
import { FunctionComponent, ReactElement } from 'react'; |
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.
Can you only import the ReactElement
type?
import { FunctionComponent, ReactElement } from 'react'; | |
import { FunctionComponent } from 'react'; | |
import type { ReactElement } from 'react'; |
import { TranslateResult, useTranslate } from 'i18n-calypso'; | ||
import { FunctionComponent } from 'react'; | ||
import { preventWidows } from 'calypso/lib/formatting'; |
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.
Nit: can you import only the TranslateResult
type?
import { TranslateResult, useTranslate } from 'i18n-calypso'; | |
import { FunctionComponent } from 'react'; | |
import { preventWidows } from 'calypso/lib/formatting'; | |
import { useTranslate } from 'i18n-calypso'; | |
import { FunctionComponent } from 'react'; | |
import { preventWidows } from 'calypso/lib/formatting'; | |
import type { TranslateResult } from `i18-calypso'; |
); | ||
}; | ||
|
||
export interface EmailProviderStackedFeatureProps { |
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.
Nit: I prefer having the prop types defined before they get used, otherwise I need to scan down to find them.
productsList: getProductsList( state ), | ||
requestingSiteDomains: isRequestingSiteDomains( state, domainName ), | ||
selectedSite, | ||
titanMailProduct: getProductBySlug( state, TITAN_MAIL_MONTHLY_SLUG ), |
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.
Maybe call this titanMailMonthlyProduct
to prep for the annual product?
domain, | ||
domainName, | ||
domainsWithForwards: getDomainsWithForwards( state, domains ), | ||
gSuiteProduct: getProductBySlug( state, GOOGLE_WORKSPACE_BUSINESS_STARTER_YEARLY ), |
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.
Maybe call this gSuiteAnnualProduct
to prep for the monthly product?
import React from 'react'; | ||
import poweredByTitanLogo from 'calypso/assets/images/email-providers/titan/powered-by-titan.svg'; | ||
import { getTitanProductName } from 'calypso/lib/titan'; | ||
import { ProviderCard } from 'calypso/my-sites/email/email-providers-stacked-comparison'; |
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.
Can we import this as a type?
import { ProviderCard } from 'calypso/my-sites/email/email-providers-stacked-comparison'; | |
import type { ProviderCard } from 'calypso/my-sites/email/email-providers-stacked-comparison'; |
formFields: <form> Placeholder </form>, | ||
formattedPrice: '3.5$', |
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.
I am not sure if these props should come from here, as they need to be computed dynamically based on the user's currency and need to wait for the query responses from the server.
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.
Yes, all those price tags has been addressed in the next pull request. Those were only placeholders :)
formFields: <form> Placeholder </form>, | ||
formattedPrice: '3.5$', | ||
onExpandedChange: noop, | ||
providerKey: '', |
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.
Should this not be 'titan'
?
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.
I've just tested and things look reasonable, especially if there are some hard-coding items that we're cleaning up in a follow-up PR (mainly the price values).
I think we do need to address the translation items and type imports in this PR, mainly because we want to get the correct strings queued up for translation.
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~1391 bytes added 📈 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~25 bytes added 📈 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
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.
Looks almost ready. There's a comment on absolute positioning that needs to be responded to.
client/my-sites/email/email-providers-stacked-comparison/email-provider-stacked-card/style.scss
Outdated
Show resolved
Hide resolved
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.
Look good at this stage.
9a2ee3f
to
7c27bbe
Compare
This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/7024644 Thank you @AllTerrainDeveloper for including a screenshot in the description! This is really helpful for our translators. |
Translation for this Pull Request has now been finished. |
Changes proposed in this Pull Request
Create a new component "EmailProvidersComparisonStacked" placeholder to wire things up.
Modify EmailPromoCard to match Saygun's design
Modify Price component to add a new property "additional information"
Create a new EmailProviderStackedCard to provide the Saygun's modifications (features inside of the card, logo at the end of it)
Work in progress
Testing instructions
?flags=emails/new-email-comparison
(it is onlyRemarks: visible through the path /email/{domain}/purchase/{site}?flags=emails/new-email-comparison
You should see the beginning of a new component being developed.
Related to 1200182182542585-as-1201414571816235
Subsequent PR