зеркало из https://github.com/mozilla/fxa.git
fix(storybook): add missing AppLocalizationProvider
Because: * We want all our Storybook components to load correctly. This commit: * Corrects localization wrapper to fix error. Closes FXA-8393
This commit is contained in:
Родитель
66f27b9a8b
Коммит
736f38db4f
|
@ -1,6 +1,7 @@
|
|||
import React, { useState } from 'react';
|
||||
import { NewUserEmailForm } from './index';
|
||||
import { Meta } from '@storybook/react';
|
||||
import AppLocalizationProvider from 'fxa-react/lib/AppLocalizationProvider';
|
||||
|
||||
export default {
|
||||
title: 'components/NewUserEmailForm',
|
||||
|
@ -55,11 +56,16 @@ const storyWithContext = (
|
|||
newsletterLabelTextCode?: string
|
||||
) => {
|
||||
const story = () => (
|
||||
<WrapNewUserEmailForm
|
||||
accountExistsReturnValue={accountExistsReturnValue}
|
||||
invalidDomain={invalidDomain}
|
||||
newsletterLabelTextCode={newsletterLabelTextCode}
|
||||
/>
|
||||
<AppLocalizationProvider
|
||||
baseDir="./locales"
|
||||
userLocales={navigator.languages}
|
||||
>
|
||||
<WrapNewUserEmailForm
|
||||
accountExistsReturnValue={accountExistsReturnValue}
|
||||
invalidDomain={invalidDomain}
|
||||
newsletterLabelTextCode={newsletterLabelTextCode}
|
||||
/>
|
||||
</AppLocalizationProvider>
|
||||
);
|
||||
|
||||
if (storyName) story.storyName = storyName;
|
||||
|
|
|
@ -6,6 +6,7 @@ import { CUSTOMER, PLAN } from '../../lib/mock-data';
|
|||
import { PickPartial } from '../../lib/types';
|
||||
import { Meta } from '@storybook/react';
|
||||
import { CheckoutType } from 'fxa-shared/subscriptions/types';
|
||||
import AppLocalizationProvider from 'fxa-react/lib/AppLocalizationProvider';
|
||||
|
||||
export default {
|
||||
title: 'Routes/Product/PaypalButton',
|
||||
|
@ -61,7 +62,15 @@ const Subject = ({
|
|||
|
||||
const storyWithContext = (storyName?: string, disabled?: boolean) => {
|
||||
const story = () => (
|
||||
<Subject disabled={disabled} checkoutType={CheckoutType.WITHOUT_ACCOUNT} />
|
||||
<AppLocalizationProvider
|
||||
baseDir="./locales"
|
||||
userLocales={navigator.languages}
|
||||
>
|
||||
<Subject
|
||||
disabled={disabled}
|
||||
checkoutType={CheckoutType.WITHOUT_ACCOUNT}
|
||||
/>
|
||||
</AppLocalizationProvider>
|
||||
);
|
||||
if (storyName) story.storyName = storyName;
|
||||
return story;
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
import React from 'react';
|
||||
import { PaymentProcessing } from '.';
|
||||
import { Meta } from '@storybook/react';
|
||||
import AppLocalizationProvider from 'fxa-react/lib/AppLocalizationProvider';
|
||||
|
||||
export default {
|
||||
title: 'Components/PaymentProcessing',
|
||||
component: PaymentProcessing,
|
||||
} as Meta;
|
||||
|
||||
const storyWithContext = (storyName?: string) => {
|
||||
const story = () => <PaymentProcessing provider="paypal" />;
|
||||
|
||||
if (storyName) story.storyName = storyName;
|
||||
return story;
|
||||
export const Default = () => {
|
||||
return (
|
||||
<AppLocalizationProvider
|
||||
baseDir="./locales"
|
||||
userLocales={navigator.languages}
|
||||
>
|
||||
<PaymentProcessing provider="paypal" />
|
||||
</AppLocalizationProvider>
|
||||
);
|
||||
};
|
||||
|
||||
export const Default = storyWithContext('default');
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
import React from 'react';
|
||||
import { AcceptedCards } from './index';
|
||||
import { Meta } from '@storybook/react';
|
||||
import AppLocalizationProvider from 'fxa-react/lib/AppLocalizationProvider';
|
||||
|
||||
export default {
|
||||
title: 'routes/Product/AcceptedCards',
|
||||
component: AcceptedCards,
|
||||
} as Meta;
|
||||
|
||||
const storyWithContext = (storyName?: string) => {
|
||||
const story = () => <AcceptedCards />
|
||||
|
||||
if (storyName) story.storyName = storyName;
|
||||
return story;
|
||||
}
|
||||
|
||||
export const Default = storyWithContext('default');
|
||||
export const Default = () => {
|
||||
return (
|
||||
<AppLocalizationProvider
|
||||
baseDir="./locales"
|
||||
userLocales={navigator.languages}
|
||||
>
|
||||
<AcceptedCards />
|
||||
</AppLocalizationProvider>
|
||||
);
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче