Skip to content

Commit

Permalink
Merge pull request #58 from mediaopt/fix-cardfield-styling
Browse files Browse the repository at this point in the history
Fix cardfield styling
  • Loading branch information
JonYeb authored Dec 13, 2023
2 parents 93c8fd7 + f45a8ce commit 69abae0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 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.83",
"version": "0.0.84",
"private": false,
"type": "module",
"license": "MIT",
Expand Down
17 changes: 8 additions & 9 deletions src/components/CardFields/CardFieldsMask.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
import { CARD_FIELDS_INPUTS, CARD_FIELDS_BUTTON } from "./constants";
import { useNotifications } from "../../app/useNotifications";
import { useLoader } from "../../app/useLoader";
import { errorFunc } from "../errorNotification";
import { useTranslation } from "react-i18next";

export const CardFieldsMask: React.FC<CardFieldsProps> = ({
enableVaulting,
Expand All @@ -27,6 +29,7 @@ export const CardFieldsMask: React.FC<CardFieldsProps> = ({
const { settings, paymentTokens } = useSettings();
const { notify } = useNotifications();
const { isLoading } = useLoader();
const { t } = useTranslation();

const [vaultId, setVaultId] = useState<string>();
const [paying, setPaying] = useState(false);
Expand Down Expand Up @@ -61,14 +64,12 @@ export const CardFieldsMask: React.FC<CardFieldsProps> = ({
approveData as ApproveVaultSetupTokenData
).catch((err) => {
setPaying(false);
isLoading(false);
notify("Error", err.message);
errorFunc(err, isLoading, notify, t);
});
} else {
handleOnApprove(approveData as CustomOnApproveData).catch((err) => {
setPaying(false);
isLoading(false);
notify("Error", err.message);
errorFunc(err, isLoading, notify, t);
});
}
};
Expand Down Expand Up @@ -133,8 +134,7 @@ export const CardFieldsMask: React.FC<CardFieldsProps> = ({
},
onError: function (error: Record<string, never>) {
setPaying(false);
isLoading(false);
notify("Error", error.message);
errorFunc(error, isLoading, notify, t);
},
});
}, []);
Expand All @@ -144,8 +144,7 @@ export const CardFieldsMask: React.FC<CardFieldsProps> = ({
isLoading(true);

cardField.submit().catch((err: Record<string, never>) => {
notify("Error", err.message);
isLoading(false);
errorFunc(err, isLoading, notify, t);
setPaying(false);
});
};
Expand Down Expand Up @@ -201,7 +200,7 @@ export const CardFieldsMask: React.FC<CardFieldsProps> = ({
{vaultId && (
<div className="h-9">
<button
className={`${hostedFieldClasses.hostedFieldsPayButtonClasses} float-left`}
className={`${hostedFieldClasses.hostedFieldsPayButtonClasses} float-right`}
onClick={() =>
handleCreateOrder({
paymentSource: "card",
Expand Down

0 comments on commit 69abae0

Please sign in to comment.