Skip to content

Commit

Permalink
PayMe improvements (#2909)
Browse files Browse the repository at this point in the history
  • Loading branch information
ribeiroguilherme authored Oct 21, 2024
1 parent 70d0d76 commit 5201bed
Show file tree
Hide file tree
Showing 13 changed files with 122 additions and 67 deletions.
5 changes: 5 additions & 0 deletions .changeset/sharp-cars-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@adyen/adyen-web': minor
---

PayMe - Improved instructions UI
15 changes: 0 additions & 15 deletions packages/lib/src/components/PayMe/Instructions.scss

This file was deleted.

22 changes: 0 additions & 22 deletions packages/lib/src/components/PayMe/Instructions.test.tsx

This file was deleted.

20 changes: 0 additions & 20 deletions packages/lib/src/components/PayMe/Instructions.tsx

This file was deleted.

7 changes: 4 additions & 3 deletions packages/lib/src/components/PayMe/PayMe.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import QRLoaderContainer from '../helpers/QRLoaderContainer';
import Instructions from './Instructions';
import { PayMeInstructions } from './components/PayMeInstructions';
import { PayMeIntroduction } from './components/PayMeIntroduction';

class PayMeElement extends QRLoaderContainer {
public static type = 'payme';
Expand All @@ -11,10 +12,10 @@ class PayMeElement extends QRLoaderContainer {
delay: PayMeElement.defaultDelay,
countdownTime: PayMeElement.defaultCountdown,
redirectIntroduction: 'payme.openPayMeApp',
introduction: 'payme.scanQrCode',
timeToPay: 'payme.timeToPay',
buttonLabel: 'payme.redirectButtonLabel',
instructions: Instructions,
introduction: PayMeIntroduction,
instructions: PayMeInstructions,
...super.formatProps(props)
};
}
Expand Down
23 changes: 23 additions & 0 deletions packages/lib/src/components/PayMe/components/PayMeInstructions.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { useIsMobile } from '../../../utils/useIsMobile';
import { useCoreContext } from '../../../core/Context/CoreProvider';
import { Timeline, TimelineWrapper } from '../../internal/Timeline';
import { h } from 'preact';

const PayMeInstructions = () => {
const { i18n } = useCoreContext();
const { isMobileScreenSize } = useIsMobile();

if (isMobileScreenSize) {
return null;
}

const instructions = i18n.get('payme.instructions.steps').split('%@');

return (
<TimelineWrapper>
<Timeline instructions={instructions} />
</TimelineWrapper>
);
};

export { PayMeInstructions };
21 changes: 21 additions & 0 deletions packages/lib/src/components/PayMe/components/PayMeIntroduction.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { useCoreContext } from '../../../core/Context/CoreProvider';
import { useIsMobile } from '../../../utils/useIsMobile';
import { Timeline, TimelineWrapper } from '../../internal/Timeline';
import { Fragment, h } from 'preact';

const PayMeIntroduction = () => {
const { i18n } = useCoreContext();
const { isMobileScreenSize } = useIsMobile();

const instructions = i18n.get('payme.instructions.steps').split('%@');

return isMobileScreenSize ? (
<TimelineWrapper>
<Timeline instructions={instructions} />
</TimelineWrapper>
) : (
<Fragment>{i18n.get('payme.scanQrCode')}</Fragment>
);
};

export { PayMeIntroduction };
3 changes: 3 additions & 0 deletions packages/lib/src/components/Swish/Swish.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.adyen-checkout__qr-loader--swish > .adyen-checkout__qr-loader__instructions {
text-align: center;
}
1 change: 1 addition & 0 deletions packages/lib/src/components/Swish/Swish.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import QRLoaderContainer from '../helpers/QRLoaderContainer/QRLoaderContainer';
import { TxVariants } from '../tx-variants';
import './Swish.scss';

class SwishElement extends QRLoaderContainer {
public static type = TxVariants.swish;
Expand Down
11 changes: 7 additions & 4 deletions packages/lib/src/components/internal/QRLoader/QRLoader.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@
.adyen-checkout__qr-loader__subtitle {
max-width: 400px;
color: token(color-label-primary);
font-size: token(text-subtitle-font-size);
line-height: token(text-caption-line-height);
font-size: token(text-body-font-size);
line-height: token(text-body-line-height);
text-align: center;
}

.adyen-checkout__qr-loader__icon {
Expand Down Expand Up @@ -80,6 +81,7 @@
text-align: center;
}


.adyen-checkout__qr-loader > .adyen-checkout__spinner__wrapper {
margin: 60px 0;
}
Expand All @@ -98,7 +100,7 @@
color: token(color-label-tertiary);
font-size: token(text-subtitle-font-size);
line-height: 1.5;
margin-top: token(spacer-040);
margin-top: token(spacer-090);
}

.adyen-checkout__qr-loader__actions {
Expand All @@ -108,8 +110,9 @@
margin-top: token(spacer-100);
}

@media only screen and (max-width: 1200px) {
@media (max-width: 1024px) {
.adyen-checkout__qr-loader__app-link {
display: block;
min-width: 220px;
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import { h } from 'preact';
import { ComponentChildren, h } from 'preact';
import './TimelineWrapper.scss';

const TimelineWrapper = ({ children }) => {
return <div className="adyen-checkout-timeline-wrapper">{children}</div>;
interface TimelineWrapperProps {
children: ComponentChildren;
className?: string;
}

const TimelineWrapper = ({ children, className }: TimelineWrapperProps) => {
return <div className={`adyen-checkout-timeline-wrapper ${className}`}>{children}</div>;
};

export { TimelineWrapper };
26 changes: 26 additions & 0 deletions packages/lib/storybook/stories/components/Payconic.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { MetaConfiguration, PaymentMethodStoryProps, StoryConfiguration } from '../types';
import { QRLoaderConfiguration } from '../../../src/types';
import { ComponentContainer } from '../ComponentContainer';
import { Checkout } from '../Checkout';
import BcmcMobile from '../../../src/components/BcmcMobile';

type PayconicStory = StoryConfiguration<QRLoaderConfiguration>;

const meta: MetaConfiguration<QRLoaderConfiguration> = {
title: 'Components/Payconic'
};

const render = ({ componentConfiguration, ...checkoutConfig }: PaymentMethodStoryProps<QRLoaderConfiguration>) => (
<Checkout checkoutConfig={checkoutConfig}>
{checkout => <ComponentContainer element={new BcmcMobile(checkout, componentConfiguration)} />}
</Checkout>
);

export const Default: PayconicStory = {
render,
args: {
countryCode: 'BE'
}
};

export default meta;
24 changes: 24 additions & 0 deletions packages/lib/storybook/stories/components/Swish.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { MetaConfiguration, PaymentMethodStoryProps, StoryConfiguration } from '../types';
import { QRLoaderConfiguration } from '../../../src/types';
import { ComponentContainer } from '../ComponentContainer';
import { Checkout } from '../Checkout';
import Swish from '../../../src/components/Swish';

type SwishStory = StoryConfiguration<QRLoaderConfiguration>;

const meta: MetaConfiguration<QRLoaderConfiguration> = {
title: 'Components/Swish'
};

const render = ({ componentConfiguration, ...checkoutConfig }: PaymentMethodStoryProps<QRLoaderConfiguration>) => (
<Checkout checkoutConfig={checkoutConfig}>{checkout => <ComponentContainer element={new Swish(checkout, componentConfiguration)} />}</Checkout>
);

export const Default: SwishStory = {
render,
args: {
countryCode: 'SE'
}
};

export default meta;

0 comments on commit 5201bed

Please sign in to comment.