Skip to content
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

refactor(payments): update PaymentErrorView to utilize Tailwind #13745

Merged
merged 1 commit into from
Aug 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,4 @@

.payment-error {
@include checkout-view();
// override grid-row rule from checkout-view FXA-3237
grid-row: 3/4;
margin-top: 0px;

.wrapper {
margin-bottom: 60px;

p {
line-height: 22px;

@include max-width('tablet') {
padding: 0 30px;
}

@include min-width('desktop') {
padding: 0 100px;
}
}
}

.button.primary-button {
margin-bottom: 40px;
}

#error-icon {
margin: 60px auto 40px;
}

@include max-width('tablet') {
margin-top: 10px;
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
import React from 'react';
import { storiesOf } from '@storybook/react';
import { PaymentErrorView } from './index';
import { SELECTED_PLAN } from '../../lib/mock-data';
import { BrowserRouter, Routes, Route } from 'react-router-dom';
import { Meta } from '@storybook/react';

storiesOf('components/PaymentError', module).add('default', () => (
<BrowserRouter>
<Routes>
<Route
path="*"
element={
<PaymentErrorView
error={{ code: 'general-paypal-error' }}
actionFn={() => {}}
plan={SELECTED_PLAN}
/>
}
/>
</Routes>
</BrowserRouter>
));
export default {
title: 'components/PaymentError',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: should this be components/PaymentErrorView?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept it the same as it was before. Leaving it for now, but will address when we return to update after the blockers have been addressed.

component: PaymentErrorView,
} as Meta;

const storyWithContext = (storyName?: string) => {
const story = () => (
<BrowserRouter>
<Routes>
<Route
path="*"
element={
<PaymentErrorView
error={{ code: 'general-paypal-error' }}
actionFn={() => {}}
plan={SELECTED_PLAN}
/>
}
/>
</Routes>
</BrowserRouter>
);

if (storyName) story.storyName = storyName;
return story;
};

export const Default = storyWithContext('default');
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ describe('PaymentErrorView test with l10n', () => {
plan={SELECTED_PLAN}
/>
);
const spinner = queryByAltText('error icon');
expect(spinner).toBeInTheDocument();

const mainBlock = queryByTestId('payment-error');
expect(mainBlock).toBeInTheDocument();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const retryButtonFn = (onRetry: PaymentErrorViewProps['actionFn']) =>
<Localized id="payment-error-retry-button">
<button
data-testid="retry-link"
className="button retry-link primary-button"
className="button primary-button mb-10"
onClick={() => onRetry()}
>
Try again
Expand All @@ -41,7 +41,7 @@ const manageSubButtonFn = (onClick: VoidFunction) => {
<Localized id="payment-error-manage-subscription-button">
<button
data-testid="manage-subscription-link"
className="button primary-button"
className="button primary-button mb-10"
onClick={onClick}
>
Manage my subscription
Expand Down Expand Up @@ -85,17 +85,20 @@ export const PaymentErrorView = ({
<>
{title}
<section
className={`container card payment-error ${className}`}
className={`payment-error row-start-3 row-end-4 mt-6 mx-4 tablet:mt-0 ${className}`}
sardesam marked this conversation as resolved.
Show resolved Hide resolved
data-testid="payment-error"
>
<div className="wrapper">
<img id="error-icon" src={errorIcon} alt="error icon" />
<div className="wrapper mb-16">
<img className="mt-16 mb-10 mx-auto" src={errorIcon} alt="" />
<div>
<Localized
id={getErrorMessage(error)}
vars={{ productName, ...contentProps }}
>
<p data-testid="error-payment-submission">
<p
className="py-0 px-7 desktop:px-24"
data-testid="error-payment-submission"
>
{getErrorMessage(error)}
</p>
</Localized>
Expand Down