diff --git a/locales/en.json b/locales/en.json index 501e3cde..2f613aca 100644 --- a/locales/en.json +++ b/locales/en.json @@ -558,7 +558,7 @@ "oncePerOrderHelpText": "If not selected, the amount will be taken off each eligible item in an order.", "oncePerOrderHelpTextWithAmount": "If not selected, {fixedAmountValue} will be taken off each eligible item in an order." }, - "DiscountAppStrategyCard": { + "DiscountApplicationStrategyCard": { "title": "Discount Application Strategy", "first": { "label": "First", diff --git a/src/components/DiscountAppStrategyCard/index.ts b/src/components/DiscountAppStrategyCard/index.ts deleted file mode 100644 index 30a64178..00000000 --- a/src/components/DiscountAppStrategyCard/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './DiscountAppStrategyCard'; diff --git a/src/components/DiscountAppStrategyCard/DiscountAppStrategyCard.tsx b/src/components/DiscountApplicationStrategyCard/DiscountApplicationStrategyCard.tsx similarity index 90% rename from src/components/DiscountAppStrategyCard/DiscountAppStrategyCard.tsx rename to src/components/DiscountApplicationStrategyCard/DiscountApplicationStrategyCard.tsx index 8b329f46..98546dae 100644 --- a/src/components/DiscountAppStrategyCard/DiscountAppStrategyCard.tsx +++ b/src/components/DiscountApplicationStrategyCard/DiscountApplicationStrategyCard.tsx @@ -12,10 +12,12 @@ export interface DiscountAppStrategyProps { } const I18N_SCOPE = { - scope: 'DiscountAppComponents.DiscountAppStrategyCard', + scope: 'DiscountAppComponents.DiscountApplicationStrategyCard', }; -export function DiscountAppStrategyCard({strategy}: DiscountAppStrategyProps) { +export function DiscountApplicationStrategyCard({ + strategy, +}: DiscountAppStrategyProps) { const [i18n] = useI18n(); const handleChange = (strategies: DiscountApplicationStrategy[]) => diff --git a/src/components/DiscountAppStrategyCard/README.md b/src/components/DiscountApplicationStrategyCard/README.md similarity index 100% rename from src/components/DiscountAppStrategyCard/README.md rename to src/components/DiscountApplicationStrategyCard/README.md diff --git a/src/components/DiscountApplicationStrategyCard/index.ts b/src/components/DiscountApplicationStrategyCard/index.ts new file mode 100644 index 00000000..9437cda7 --- /dev/null +++ b/src/components/DiscountApplicationStrategyCard/index.ts @@ -0,0 +1 @@ +export * from './DiscountApplicationStrategyCard'; diff --git a/src/components/DiscountAppStrategyCard/tests/DiscountAppStrategyCard.test.tsx b/src/components/DiscountApplicationStrategyCard/tests/DiscountApplicationStrategyCard.test.tsx similarity index 64% rename from src/components/DiscountAppStrategyCard/tests/DiscountAppStrategyCard.test.tsx rename to src/components/DiscountApplicationStrategyCard/tests/DiscountApplicationStrategyCard.test.tsx index f3738511..d9c2c9e7 100644 --- a/src/components/DiscountAppStrategyCard/tests/DiscountAppStrategyCard.test.tsx +++ b/src/components/DiscountApplicationStrategyCard/tests/DiscountApplicationStrategyCard.test.tsx @@ -2,10 +2,10 @@ import React from 'react'; import {ChoiceList, TextField} from '@shopify/polaris'; import {mockField, mountWithApp} from 'tests/utilities'; -import {DiscountAppStrategyCard} from '../DiscountAppStrategyCard'; +import {DiscountApplicationStrategyCard} from '../DiscountApplicationStrategyCard'; import {DiscountApplicationStrategy} from '../../../types'; -describe('', () => { +describe('', () => { const mockProps = { strategy: mockField(DiscountApplicationStrategy.First), }; @@ -14,8 +14,10 @@ describe('', () => { jest.resetAllMocks(); }); - it('renders a DiscountAppStrategyCard', () => { - const methodCard = mountWithApp(); + it('renders a DiscountApplicationStrategyCard', () => { + const methodCard = mountWithApp( + , + ); expect(methodCard).not.toContainReactComponent(TextField, { label: 'Title', @@ -23,7 +25,9 @@ describe('', () => { }); it('calls onChange when the strategy is changed', () => { - const methodCard = mountWithApp(); + const methodCard = mountWithApp( + , + ); methodCard .find(ChoiceList) diff --git a/src/index.ts b/src/index.ts index fd711354..e02bc3dc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -109,4 +109,4 @@ export {onBreadcrumbAction, handleRedirect} from './utilities/navigation'; export {generateRandomDiscountCode} from './components/DiscountCodeGenerator/utilities'; export {ValueCard} from './components/ValueCard'; -export {DiscountAppStrategyCard} from './components/DiscountAppStrategyCard'; +export {DiscountApplicationStrategyCard} from './components/DiscountApplicationStrategyCard'; diff --git a/src/stories/patterns/DiscountAppStrategyCardPattern/DiscountAppStrategyCardPattern.tsx b/src/stories/patterns/DiscountAppStrategyCardPattern/DiscountAppStrategyCardPattern.tsx deleted file mode 100644 index 18bdedb1..00000000 --- a/src/stories/patterns/DiscountAppStrategyCardPattern/DiscountAppStrategyCardPattern.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import React from 'react'; - -import {Page} from '@shopify/polaris'; -import {DiscountAppStrategyCard} from '../../../components/DiscountAppStrategyCard'; -import {DiscountApplicationStrategy} from '../../../types'; - -export default function MethodCardPattern() { - return ( - - - - ); -} diff --git a/src/stories/patterns/DiscountAppStrategyCardPattern/DiscountAppStrategyCardPattern.stories.tsx b/src/stories/patterns/DiscountApplicationStrategyCardPattern/DiscountApplicationStrategyCardPattern.stories.tsx similarity index 66% rename from src/stories/patterns/DiscountAppStrategyCardPattern/DiscountAppStrategyCardPattern.stories.tsx rename to src/stories/patterns/DiscountApplicationStrategyCardPattern/DiscountApplicationStrategyCardPattern.stories.tsx index 3153e5de..32a1e2cd 100644 --- a/src/stories/patterns/DiscountAppStrategyCardPattern/DiscountAppStrategyCardPattern.stories.tsx +++ b/src/stories/patterns/DiscountApplicationStrategyCardPattern/DiscountApplicationStrategyCardPattern.stories.tsx @@ -1,10 +1,10 @@ import React from 'react'; import {Provider} from '../../foundation/Provider'; -import DiscountAppStrategyCard from './DiscountAppStrategyCardPattern'; +import DiscountApplicationStrategyCard from './DiscountApplicationStrategyCardPattern'; // eslint-disable-next-line import/no-default-export, import/no-anonymous-default-export export default { - title: 'DiscountAppStrategyCard pattern', + title: 'DiscountApplicationStrategyCard pattern', parameters: { layout: 'fullscreen', }, @@ -12,7 +12,7 @@ export default { const ApplicationStrategyCardPattern = () => ( - + ); diff --git a/src/stories/patterns/DiscountApplicationStrategyCardPattern/DiscountApplicationStrategyCardPattern.tsx b/src/stories/patterns/DiscountApplicationStrategyCardPattern/DiscountApplicationStrategyCardPattern.tsx new file mode 100644 index 00000000..011508e7 --- /dev/null +++ b/src/stories/patterns/DiscountApplicationStrategyCardPattern/DiscountApplicationStrategyCardPattern.tsx @@ -0,0 +1,21 @@ +import React, {useState} from 'react'; + +import {Page} from '@shopify/polaris'; +import {DiscountApplicationStrategyCard} from '../../../components/DiscountApplicationStrategyCard'; +import {DiscountApplicationStrategy} from '../../../types'; + +export default function MethodCardPattern() { + const [strategy, setStrategy] = useState( + DiscountApplicationStrategy.First, + ); + return ( + + + + ); +}