Skip to content

Commit

Permalink
Merge pull request #44 from mediaopt/feature/35223-color-for-buttons
Browse files Browse the repository at this point in the history
#35223 only set colors for PayPal buttons
  • Loading branch information
JonYeb authored Dec 4, 2023
2 parents c2815b7 + 34d1bb8 commit 72d5444
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "paypal-commercetools-client",
"version": "0.0.69",
"version": "0.0.70",
"private": false,
"type": "module",
"license": "MIT",
Expand Down
12 changes: 12 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,18 @@ function App() {
/>
),
PayPalMessages: <PayPalMessages {...PayPalMessagesJson} />,
Card: (
<PayPal
{...params}
requestHeader={requestHeader}
options={{
...options,
components: "messages,buttons",
enableFunding: "card",
}}
fundingSource="card"
/>
),
HostedFields: <HostedFields {...HostedFieldsJson} />,
HostedFieldsVault: (
<HostedFields
Expand Down
25 changes: 14 additions & 11 deletions src/components/PayPal/PayPalMask.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,21 @@ export const PayPalMask: React.FC<CustomPayPalButtonsComponentProps> = (
if (restprops.style || !settings) {
return restprops.style;
}
if (
settings.paypalButtonConfig &&
settings.buttonTagline &&
settings.buttonShape
) {
return {
color: settings.paypalButtonConfig.buttonColor,
label: settings.paypalButtonConfig.buttonLabel,
shape: settings.buttonShape,
};
let styles: Record<string, string | boolean> = {};
if (settings.paypalButtonConfig) {
styles.label = settings.paypalButtonConfig.buttonLabel;
if (
props.fundingSource &&
["paypal", "paylater"].includes(props.fundingSource)
) {
styles.color = settings.paypalButtonConfig.buttonColor;
}
}
return restprops.style;
if (settings.buttonShape) {
styles.shape = settings.buttonShape;
}

return styles;
}, [settings, restprops]);

const errorFunc = (err: Record<string, unknown>) => {
Expand Down

0 comments on commit 72d5444

Please sign in to comment.