Skip to content

Commit

Permalink
Add disabled states, display pay text properly
Browse files Browse the repository at this point in the history
Disabled states mainly just to disable focus styles
  • Loading branch information
joonassandell committed Jul 20, 2024
1 parent 4f91a76 commit 3774b73
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/dynamic-pay-button/PayButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const PayButton = ({ className }: PayButtonProps) => {
},
className,
)}
disabled={success || loading}
onClick={handleLoading}
>
<AnimateDimension
Expand All @@ -48,7 +49,7 @@ export const PayButton = ({ className }: PayButtonProps) => {
transition={TRANS_SPRING_FAST}
whileTap={{ scale: loading || success ? 1 : 0.88 }}
>
{(!loading || !success) && 'Pay Now'}
{((!loading && !success) || (loading && !success)) && 'Pay Now'}
{loading && !success && (
<m.div
animate={{ scale: 1 }}
Expand Down
3 changes: 2 additions & 1 deletion app/dynamic-pay-button/TabContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const TabContent = ({ value }: TabContentProps) => {
};

const TabContentCard = () => {
const { ccv, inputRef, setCcv, setSwitchCard, success } =
const { ccv, inputRef, loading, setCcv, setSwitchCard, success } =
useDynamicPayButton();

return (
Expand Down Expand Up @@ -73,6 +73,7 @@ const TabContentCard = () => {
success,
},
)}
disabled={success || loading}
maxLength={3}
onChange={e => setCcv(e.target.value)}
pattern="\d*"
Expand Down

0 comments on commit 3774b73

Please sign in to comment.