mars-v2-frontend/components/Modal.tsx
Linkie Link 2f7b266e6b
Mp 1671 header (#59)
* MP-1674: replaced the logo and added dekstop only nav

* MP-1677: borrowCapacity implemented into the SubAccount Nav

* MP-1677: adjusted the SubAccount navigation

* M1677: fixed the button and SearchInput component

* MP-1674: fixed the NavLink component

* MP-1674: fixed the SubAccount navigation

* tidy: cleaning up the trading view

* MP-1674: added withdraw and funding functions

* MP-1674: worked on the AccountStats

* MP-1671: modal work

* MP-1647: improvised CreditAccount expander

* tidy: fixed the page structure

* MP-1758: finished the SearchInput layout

* MP-1759: updated the semicircle graphs

* MP-1759: SemiCircle to Gauge

* fix: implemented animated numbers

* tidy: refactor

* MP-1759: added Tooltip to the Gauge

* fix: replace animate={true} with animate

* fix: fixed the Gauge timing

* fix: updated the BorrowCapacity styles

* fix: renamed SubAccount to Account

* fix: Text should not be a button, Button should be

* tidy: format

* fix: Text no clicky

* fix: replaced all the Text appearances with onClick
2022-12-06 10:20:22 +01:00

46 lines
1.3 KiB
TypeScript

import classNames from 'classnames'
import { ReactNode } from 'react'
import Card from 'components/Card'
import CloseIcon from 'components/Icons/close.svg'
interface Props {
children?: ReactNode | string
content?: ReactNode | string
className?: string
open: boolean
setOpen?: (open: boolean) => void
}
const Modal = ({ children, content, className, open, setOpen }: Props) => {
const onClickAway = () => {
if (setOpen) setOpen(false)
}
return open ? (
<div className='fixed top-0 left-0 z-20 h-screen w-screen'>
<div className='relative flex h-full w-full items-center justify-center'>
<Card className={classNames('relative z-40 w-[790px] max-w-full p-0', className)}>
{setOpen && (
<span
className='absolute top-4 right-4 z-50 w-[32px] text-white opacity-60 hover:cursor-pointer hover:opacity-100'
onClick={onClickAway}
role='button'
>
<CloseIcon />
</span>
)}
{children ? children : content}
</Card>
<div
className='fixed top-0 left-0 z-30 block h-full w-full bg-black/70 backdrop-blur hover:cursor-pointer'
onClick={onClickAway}
role='button'
/>
</div>
</div>
) : null
}
export default Modal