-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from Staketab/dev
Purchase popup
- Loading branch information
Showing
7 changed files
with
182 additions
and
3 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
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 @@ | ||
export { default as ModalInfo } from "./modalInfo"; |
79 changes: 79 additions & 0 deletions
79
ui/components/molecules/modals/modalPurchase/index.module.css
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,79 @@ | ||
.wrapper { | ||
border-radius: 12px; | ||
background: var(--col--light); | ||
padding: 24px 24px 34px 24px; | ||
width: 654px; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
|
||
.header { | ||
font-size: 28px; | ||
} | ||
|
||
.header span { | ||
color: #9c9ea6; | ||
} | ||
|
||
.periodWrapper { | ||
border-radius: 35px; | ||
border: 1px solid rgba(0, 0, 0, 0.4); | ||
padding: 10px; | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
margin: 22px 0; | ||
width: 100%; | ||
} | ||
|
||
.periodWrapper > div { | ||
color: #88d6a9; | ||
font-size: 28px; | ||
font-weight: 500; | ||
} | ||
|
||
.minus, | ||
.plus { | ||
display: flex; | ||
width: 50px; | ||
height: 50px; | ||
justify-content: center; | ||
align-items: center; | ||
border-radius: 50%; | ||
border: 1px solid #597fff; | ||
font-size: 20px; | ||
color: #597fff; | ||
cursor: pointer; | ||
} | ||
|
||
.disableActionIcon { | ||
cursor: default; | ||
border-color: var(--col--border); | ||
color: rgba(0, 0, 0, 0.3); | ||
} | ||
|
||
.costInformation { | ||
display: flex; | ||
flex-direction: column; | ||
width: 100%; | ||
padding: 16px 12px; | ||
gap: 8px; | ||
border-radius: 9px; | ||
background: #f7f8fa; | ||
margin-bottom: 32px; | ||
} | ||
|
||
.costInformation > div { | ||
display: flex; | ||
justify-content: space-between; | ||
color: rgba(0, 0, 0, 0.6); | ||
} | ||
|
||
.totalText { | ||
color: rgba(0, 0, 0, 0.6); | ||
} | ||
|
||
.costInformation > div span:last-child { | ||
color: var(--col--dark) | ||
} |
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 @@ | ||
export { default as ModalPurchase } from "./modalPurchase"; |
88 changes: 88 additions & 0 deletions
88
ui/components/molecules/modals/modalPurchase/modalPurchase.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,88 @@ | ||
import classNames from "classnames"; | ||
import PopupOverlay from "../../popupOverlay"; | ||
|
||
import style from "./index.module.css"; | ||
import { interBold, interMedium, interSemiBold } from "@/app/fonts"; | ||
import { Button } from "@/components/atoms/button"; | ||
import { Variant } from "@/components/atoms/button/types"; | ||
import { useState } from "react"; | ||
|
||
type ModalPurchaseProps = { | ||
name: string; | ||
open: boolean; | ||
onClose: () => void; | ||
}; | ||
|
||
const ModalPurchase = ({ | ||
open, | ||
onClose, | ||
name, | ||
}: ModalPurchaseProps): JSX.Element => { | ||
const [selectedPeriod, setSelectedPeriod] = useState<number>(1); | ||
const maxPeriod = 3; | ||
const minPeriod = 1; | ||
|
||
const increment = (): void => { | ||
if (selectedPeriod === maxPeriod) return; | ||
setSelectedPeriod(selectedPeriod + 1); | ||
}; | ||
|
||
const decrement = (): void => { | ||
if (selectedPeriod === minPeriod) return; | ||
setSelectedPeriod(selectedPeriod - 1); | ||
}; | ||
return ( | ||
<PopupOverlay | ||
position="center" | ||
animation="appear" | ||
onClose={onClose} | ||
show={open} | ||
> | ||
<div className={style.wrapper}> | ||
<div className={classNames(style.header, interMedium.className)}> | ||
{name}<span>.mina</span> | ||
</div> | ||
<div | ||
className={classNames(style.periodWrapper, interSemiBold.className)} | ||
> | ||
<span | ||
className={classNames(style.minus, { | ||
[style.disableActionIcon]: selectedPeriod === minPeriod, | ||
})} | ||
onClick={decrement} | ||
> | ||
- | ||
</span> | ||
<div className={interMedium.className}>{selectedPeriod} year</div> | ||
<span | ||
className={classNames(style.plus, { | ||
[style.disableActionIcon]: selectedPeriod === maxPeriod, | ||
})} | ||
onClick={increment} | ||
> | ||
+ | ||
</span> | ||
</div> | ||
<div | ||
className={classNames(style.costInformation, interMedium.className)} | ||
> | ||
<div> | ||
<span>1 year registration</span> | ||
<span className={interSemiBold.className}>10 MINA</span> | ||
</div> | ||
<div> | ||
<span>Est. network fee</span> | ||
<span className={interSemiBold.className}>0.00000312 MINA</span> | ||
</div> | ||
<div> | ||
<span className={classNames(style.totalText, interBold.className)}>Estimated Total</span> | ||
<span className={interSemiBold.className}>10.00000312 MINA</span> | ||
</div> | ||
</div> | ||
<Button text="Purchase" variant={Variant.blue} disabled /> | ||
</div> | ||
</PopupOverlay> | ||
); | ||
}; | ||
|
||
export default ModalPurchase; |