-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add BuyFiatModal to handle purchase issues
- Loading branch information
Showing
4 changed files
with
214 additions
and
26 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
web-marketplace/src/components/organisms/BuyFiatModal/BuyFiatModal.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,46 @@ | ||
import { Box } from '@mui/material'; | ||
|
||
import OutlinedButton from 'web-components/src/components/buttons/OutlinedButton'; | ||
import Card from 'web-components/src/components/cards/Card'; | ||
import SellOrderNotFoundIcon from 'web-components/src/components/icons/SellOrderNotFoundIcon'; | ||
import Modal from 'web-components/src/components/modal'; | ||
import { Title } from 'web-components/src/components/typography'; | ||
|
||
import { UseStateSetter } from 'types/react/use-state'; | ||
|
||
import { UserCanPurchaseCreditsType } from './BuyFiatModal.types'; | ||
|
||
interface BuyFiatModalProps { | ||
title: string; | ||
content: React.ReactNode; | ||
button: { text: string; href: string | null }; | ||
userCanPurchaseCredits: UserCanPurchaseCreditsType; | ||
onClose: UseStateSetter<UserCanPurchaseCreditsType>; | ||
handleClick: () => void; | ||
} | ||
|
||
export const BuyFiatModal = ({ | ||
title, | ||
content, | ||
button, | ||
userCanPurchaseCredits, | ||
onClose, | ||
handleClick, | ||
}: BuyFiatModalProps) => { | ||
return ( | ||
<Modal | ||
open={userCanPurchaseCredits.openModal} | ||
onClose={() => onClose({ ...userCanPurchaseCredits, openModal: false })} | ||
className="w-[560px] !py-40 !px-30" | ||
> | ||
<Box className="flex flex-col items-center"> | ||
<SellOrderNotFoundIcon className="w-[100px] h-[100px]" /> | ||
<Title variant="h4" className="text-center mt-20 px-30"> | ||
{title} | ||
</Title> | ||
<Card className="text-left w-full py-40 px-30 my-40">{content}</Card> | ||
<OutlinedButton onClick={handleClick}>{button.text}</OutlinedButton> | ||
</Box> | ||
</Modal> | ||
); | ||
}; |
4 changes: 4 additions & 0 deletions
4
web-marketplace/src/components/organisms/BuyFiatModal/BuyFiatModal.types.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export type UserCanPurchaseCreditsType = { | ||
openModal: boolean; | ||
amountAvailable: number; | ||
}; |
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