From 4b43dbffc574a56a7fbb4ce4cadb36af30cde43f Mon Sep 17 00:00:00 2001 From: Lisa Chan Date: Mon, 21 Nov 2022 19:26:02 -0500 Subject: [PATCH 1/2] refactor(payments-server): Convert responsive design in Checkout component to use Tailwind --- .../src/components/NewUserEmailForm/index.tsx | 4 +- .../components/PaymentConfirmation/index.tsx | 2 +- .../src/components/PaymentErrorView/index.tsx | 2 +- .../components/PaymentProcessing/index.tsx | 2 +- .../PaymentProviderDetails/index.scss | 1 + .../components/SubscriptionTitle/index.tsx | 2 +- .../src/routes/Checkout/index.scss | 41 --------------- .../src/routes/Checkout/index.tsx | 51 +++++++++---------- .../Product/SubscriptionCreate/index.scss | 2 +- .../PlanUpgradeDetails.tsx | 2 +- .../SubscriptionUpgrade/index.stories.tsx | 16 +++++- .../src/styles/tailwind.css | 11 ++-- 12 files changed, 56 insertions(+), 80 deletions(-) delete mode 100644 packages/fxa-payments-server/src/routes/Checkout/index.scss diff --git a/packages/fxa-payments-server/src/components/NewUserEmailForm/index.tsx b/packages/fxa-payments-server/src/components/NewUserEmailForm/index.tsx index 0af73b77b8..0c3751604f 100644 --- a/packages/fxa-payments-server/src/components/NewUserEmailForm/index.tsx +++ b/packages/fxa-payments-server/src/components/NewUserEmailForm/index.tsx @@ -110,7 +110,9 @@ export const NewUserEmailForm = ({

-
+ +
+
diff --git a/packages/fxa-payments-server/src/components/PaymentErrorView/index.tsx b/packages/fxa-payments-server/src/components/PaymentErrorView/index.tsx index ebeb146fd7..7cbd5c1263 100644 --- a/packages/fxa-payments-server/src/components/PaymentErrorView/index.tsx +++ b/packages/fxa-payments-server/src/components/PaymentErrorView/index.tsx @@ -153,7 +153,7 @@ export const PaymentErrorView = ({ <> {title}
diff --git a/packages/fxa-payments-server/src/components/PaymentProcessing/index.tsx b/packages/fxa-payments-server/src/components/PaymentProcessing/index.tsx index 35ccdf100b..9156aed5ec 100644 --- a/packages/fxa-payments-server/src/components/PaymentProcessing/index.tsx +++ b/packages/fxa-payments-server/src/components/PaymentProcessing/index.tsx @@ -21,7 +21,7 @@ export const PaymentProcessing = ({ <>
diff --git a/packages/fxa-payments-server/src/components/PaymentProviderDetails/index.scss b/packages/fxa-payments-server/src/components/PaymentProviderDetails/index.scss index 1ab3c090dc..fc6c4bf1a3 100644 --- a/packages/fxa-payments-server/src/components/PaymentProviderDetails/index.scss +++ b/packages/fxa-payments-server/src/components/PaymentProviderDetails/index.scss @@ -27,6 +27,7 @@ color: rgba(0, 0, 0, 0); width: 90px; height: 24px; + margin: 16px 0; position: relative; } diff --git a/packages/fxa-payments-server/src/components/SubscriptionTitle/index.tsx b/packages/fxa-payments-server/src/components/SubscriptionTitle/index.tsx index 7a99f951a6..acc03e771f 100644 --- a/packages/fxa-payments-server/src/components/SubscriptionTitle/index.tsx +++ b/packages/fxa-payments-server/src/components/SubscriptionTitle/index.tsx @@ -35,7 +35,7 @@ export const SubscriptionTitle = ({ return (
diff --git a/packages/fxa-payments-server/src/routes/Checkout/index.scss b/packages/fxa-payments-server/src/routes/Checkout/index.scss deleted file mode 100644 index d0119b90f3..0000000000 --- a/packages/fxa-payments-server/src/routes/Checkout/index.scss +++ /dev/null @@ -1,41 +0,0 @@ -@import '../../../../fxa-content-server/app/styles/variables'; -@import '../../../../fxa-content-server/app/styles/breakpoints'; - -.checkout-payment { - @include max-width('tablet') { - grid-row: 4/5; - border-radius: 8px; - margin: 24px 16px; - min-height: 100%; - } - - @media (orientation: landscape) and (max-width: 927px) and (max-height: 429px) { - grid-row: 4/5; - border-radius: 8px; - margin: 24px 16px; - min-height: 100%; - } - - @media (orientation: portrait) and (max-width: 429px) and (max-height: 927px) { - grid-row: 4/5; - border-radius: 8px; - margin: 24px 16px; - min-height: 100%; - } - - @include min-width('desktop') { - padding: 16px 48px 48px; - } -} - -.pay-with-heading { - &:before, - &:after { - content: ''; - border-top: 1px solid #e0e0e6; - } - - @include max-width('tablet') { - margin-top: 16px; - } -} diff --git a/packages/fxa-payments-server/src/routes/Checkout/index.tsx b/packages/fxa-payments-server/src/routes/Checkout/index.tsx index 6b293097c1..a7f81a41e9 100644 --- a/packages/fxa-payments-server/src/routes/Checkout/index.tsx +++ b/packages/fxa-payments-server/src/routes/Checkout/index.tsx @@ -34,7 +34,6 @@ import { Customer, Profile } from '../../store/types'; import AcceptedCards from '../Product/AcceptedCards'; -import './index.scss'; import PaymentForm, { StripePaymentSubmitResult, StripePaymentUpdateResult, @@ -344,9 +343,32 @@ export const Checkout = ({ })} /> + {transactionInProgress && isMobile ? null : ( +
+ + + +
+ )} +
-
+
- - {transactionInProgress && isMobile ? null : ( -
- - - -
- )}
); diff --git a/packages/fxa-payments-server/src/routes/Product/SubscriptionCreate/index.scss b/packages/fxa-payments-server/src/routes/Product/SubscriptionCreate/index.scss index 5b88e7f5d3..c91efd8cf2 100644 --- a/packages/fxa-payments-server/src/routes/Product/SubscriptionCreate/index.scss +++ b/packages/fxa-payments-server/src/routes/Product/SubscriptionCreate/index.scss @@ -20,7 +20,7 @@ box-shadow: 0px 1px 4px 0px rgb(158, 158, 158); color: rgba(12, 12, 13, 0.8); grid-row: 4/5; - margin: 24px 16px; + margin-bottom: 24px; min-height: 100%; padding: 16px 16px 60px; diff --git a/packages/fxa-payments-server/src/routes/Product/SubscriptionUpgrade/PlanUpgradeDetails.tsx b/packages/fxa-payments-server/src/routes/Product/SubscriptionUpgrade/PlanUpgradeDetails.tsx index 8ee7f32002..c265ed9b21 100644 --- a/packages/fxa-payments-server/src/routes/Product/SubscriptionUpgrade/PlanUpgradeDetails.tsx +++ b/packages/fxa-payments-server/src/routes/Product/SubscriptionUpgrade/PlanUpgradeDetails.tsx @@ -34,7 +34,7 @@ export const PlanUpgradeDetails = ({ return (
diff --git a/packages/fxa-payments-server/src/routes/Product/SubscriptionUpgrade/index.stories.tsx b/packages/fxa-payments-server/src/routes/Product/SubscriptionUpgrade/index.stories.tsx index c9c7b373b9..8edfae14c7 100644 --- a/packages/fxa-payments-server/src/routes/Product/SubscriptionUpgrade/index.stories.tsx +++ b/packages/fxa-payments-server/src/routes/Product/SubscriptionUpgrade/index.stories.tsx @@ -10,6 +10,7 @@ import { SignInLayout } from '../../../components/AppLayout'; import { CUSTOMER, + PAYPAL_CUSTOMER, SELECTED_PLAN, UPGRADE_FROM_PLAN, PROFILE, @@ -20,7 +21,7 @@ import { WebSubscription } from 'fxa-shared/subscriptions/types'; function init() { storiesOf('routes/Product/SubscriptionUpgrade', module) - .add('upgrade offer', () => ( + .add('upgrade offer - Visa', () => ( )) + .add('upgrade offer - PayPal', () => ( + linkToUpgradeSuccess(), + }} + /> + )) .add('upgrade offer localized to xx-pirate', () => ( Date: Tue, 22 Nov 2022 14:54:49 -0500 Subject: [PATCH 2/2] Updates - includes feedback from Reino, Peter and fixes other pages --- .../src/components/PaymentErrorView/index.tsx | 2 +- .../src/routes/Checkout/index.tsx | 2 +- .../Product/SubscriptionCreate/index.scss | 6 +- .../Product/SubscriptionCreate/index.tsx | 56 ++++++++++--------- .../PlanUpgradeDetails.tsx | 2 +- .../Product/SubscriptionUpgrade/index.tsx | 23 ++++---- .../src/styles/tailwind.css | 9 +-- 7 files changed, 52 insertions(+), 48 deletions(-) diff --git a/packages/fxa-payments-server/src/components/PaymentErrorView/index.tsx b/packages/fxa-payments-server/src/components/PaymentErrorView/index.tsx index 7cbd5c1263..2e43ed6f7f 100644 --- a/packages/fxa-payments-server/src/components/PaymentErrorView/index.tsx +++ b/packages/fxa-payments-server/src/components/PaymentErrorView/index.tsx @@ -153,7 +153,7 @@ export const PaymentErrorView = ({ <> {title}
diff --git a/packages/fxa-payments-server/src/routes/Checkout/index.tsx b/packages/fxa-payments-server/src/routes/Checkout/index.tsx index a7f81a41e9..d912aafa8c 100644 --- a/packages/fxa-payments-server/src/routes/Checkout/index.tsx +++ b/packages/fxa-payments-server/src/routes/Checkout/index.tsx @@ -368,7 +368,7 @@ export const Checkout = ({
+ + {transactionInProgress && isMobile ? null : ( +
+ + + +
+ )} +
}
- - {transactionInProgress && isMobile ? null : ( -
- - - -
- )}
); diff --git a/packages/fxa-payments-server/src/routes/Product/SubscriptionUpgrade/PlanUpgradeDetails.tsx b/packages/fxa-payments-server/src/routes/Product/SubscriptionUpgrade/PlanUpgradeDetails.tsx index c265ed9b21..19f7d68213 100644 --- a/packages/fxa-payments-server/src/routes/Product/SubscriptionUpgrade/PlanUpgradeDetails.tsx +++ b/packages/fxa-payments-server/src/routes/Product/SubscriptionUpgrade/PlanUpgradeDetails.tsx @@ -34,7 +34,7 @@ export const PlanUpgradeDetails = ({ return (
diff --git a/packages/fxa-payments-server/src/routes/Product/SubscriptionUpgrade/index.tsx b/packages/fxa-payments-server/src/routes/Product/SubscriptionUpgrade/index.tsx index 91cf8f7036..96e86d6c0b 100644 --- a/packages/fxa-payments-server/src/routes/Product/SubscriptionUpgrade/index.tsx +++ b/packages/fxa-payments-server/src/routes/Product/SubscriptionUpgrade/index.tsx @@ -120,8 +120,20 @@ export const SubscriptionUpgrade = ({ )}
+
+ +
+
{!isMobile ? ( @@ -197,15 +209,6 @@ export const SubscriptionUpgrade = ({
- {mobileUpdateHeading}
diff --git a/packages/fxa-payments-server/src/styles/tailwind.css b/packages/fxa-payments-server/src/styles/tailwind.css index f47d936707..44a91add02 100644 --- a/packages/fxa-payments-server/src/styles/tailwind.css +++ b/packages/fxa-payments-server/src/styles/tailwind.css @@ -26,7 +26,7 @@ } .payment-panel { - @apply mb-6 tablet:mt-6 tablet:max-w-xs tablet:col-start-2 tablet:col-end-auto tablet:row-start-1 tablet:row-end-3; + @apply mb-6 tablet:mt-6 tablet:min-w-[18rem] tablet:max-w-xs tablet:col-start-2 tablet:col-end-auto tablet:row-start-1 tablet:row-end-3; } /* footer copy */ @@ -52,7 +52,7 @@ /* shared styles used in Checkout and SubscriptionCreate*/ .pay-with-heading { - @apply gap-5 grid grid-cols-[minmax(20px,_1fr)_auto_minmax(20px,_1fr)] items-center mx-0 mb-6 text-center text-grey-400 w-full; + @apply gap-5 grid grid-cols-[minmax(20px,_1fr)_auto_minmax(20px,_1fr)] items-center mb-6 text-grey-400; @apply before:content-[''] before:border-b before:border-0 before:border-solid before:border-grey-200; @apply after:content-[''] after:border-b after:border-0 after:border-solid after:border-grey-200; } @@ -128,8 +128,9 @@ } .main-content { - @apply grid mt-16 mx-6; - @apply tablet:grid-cols-[minmax(min-content,500px)_minmax(20rem,1fr)] tablet:gap-x-12 tablet:mt-[80px] tablet:mb-auto tablet:mx-3; + @apply mt-16 mx-7 min-h-[calc(100vh_-_4rem)]; + @apply tablet:grid tablet:grid-cols-[minmax(min-content,500px)_minmax(20rem,1fr)] tablet:grid-rows-[min-content] tablet:gap-x-8 tablet:mt-[80px] tablet:mb-auto; + @apply desktop:grid-cols-[600px_1fr]; } .payment-button {