-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
30fe041
commit 5687ba4
Showing
14 changed files
with
217 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 11 additions & 2 deletions
13
packages/lib/src/components/Dropin/elements/splitPaymentMethods.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
packages/lib/src/components/PayPalFastlane/components/FaslaneBrandIcon.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { h } from 'preact'; | ||
import useImage from '../../../core/Context/useImage'; | ||
import Img from '../../internal/Img'; | ||
import { getFullBrandName } from '../../Card/components/CardInput/utils'; | ||
|
||
interface FastlaneBrandIconProps { | ||
brand: string; | ||
} | ||
|
||
const FastlaneBrandIcon = ({ brand }: FastlaneBrandIconProps) => { | ||
const getImage = useImage(); | ||
|
||
return ( | ||
<span className="adyen-checkout-fastlane__card-brand--wrapper"> | ||
<Img src={getImage()(brand)} alt={getFullBrandName(brand)} /> | ||
</span> | ||
); | ||
}; | ||
|
||
export default FastlaneBrandIcon; |
32 changes: 32 additions & 0 deletions
32
packages/lib/src/components/PayPalFastlane/components/Fastlane.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
@import 'styles/variable-generator'; | ||
|
||
.adyen-checkout-fastlane__card-brand--wrapper { | ||
position: relative; | ||
display: flex; | ||
width: token(spacer-110); | ||
height: 26px; | ||
justify-content: center; | ||
align-items: center; | ||
border-radius: token(border-radius-s); | ||
overflow: hidden; | ||
box-shadow: token(shadow-low); | ||
margin-right: 12px; | ||
} | ||
|
||
|
||
.adyen-checkout-fastlane__card-section { | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.adyen-checkout-fastlane__card-number { | ||
line-height: 20px; | ||
font-size: 14px; | ||
font-weight: 500; | ||
} | ||
|
||
.adyen-checkout-fastlane__brand { | ||
display: flex; | ||
justify-content: center; | ||
margin-top: 16px; | ||
} |
45 changes: 45 additions & 0 deletions
45
packages/lib/src/components/PayPalFastlane/components/FastlaneComponent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { h } from 'preact'; | ||
import { ComponentMethodsRef, PayButtonFunctionProps, UIElementStatus } from '../../internal/UIElement/types'; | ||
import { useEffect, useRef, useState } from 'preact/hooks'; | ||
import FastlaneBrandIcon from './FaslaneBrandIcon'; | ||
import { PREFIX } from '../../internal/Icon/constants'; | ||
import useImage from '../../../core/Context/useImage'; | ||
import Img from '../../internal/Img'; | ||
import './Fastlane.scss'; | ||
|
||
interface FastlaneComponentProps { | ||
lastFour: string; | ||
brand: string; | ||
showPayButton: boolean; | ||
setComponentRef: (ref: ComponentMethodsRef) => void; | ||
payButton(props?: PayButtonFunctionProps): h.JSX.Element; | ||
} | ||
|
||
const FastlaneComponent = ({ lastFour, brand, payButton, setComponentRef, showPayButton }: FastlaneComponentProps) => { | ||
const getImage = useImage(); | ||
const [status, setStatus] = useState<UIElementStatus>('ready'); | ||
const fastlaneRef = useRef({ | ||
setStatus: (status: UIElementStatus) => setStatus(status) | ||
}); | ||
|
||
useEffect(() => { | ||
setComponentRef(fastlaneRef.current); | ||
}, []); | ||
|
||
return ( | ||
<div className="adyen-checkout-fastlane"> | ||
<div className="adyen-checkout-fastlane__card-section"> | ||
<FastlaneBrandIcon brand={brand} /> | ||
<span className="adyen-checkout-fastlane__card-number">•••• {lastFour}</span> | ||
</div> | ||
|
||
{showPayButton && payButton({ status, icon: getImage({ imageFolder: 'components/' })(`${PREFIX}lock`) })} | ||
|
||
<div className="adyen-checkout-fastlane__brand"> | ||
<Img width="95px" src={getImage({ imageFolder: 'components/' })(`paypal_fastlane_gray`)} alt="Fastlane brand" /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default FastlaneComponent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.