You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.2 KiB

import React from 'react'
import PropTypes from 'prop-types'
import { FaClose } from 'react-icons/lib/fa'
import SuccessfulSendCoins from './SuccessfulSendCoins'
import SuccessfulSendPayment from './SuccessfulSendPayment'
import WalletDetails from './WalletDetails'
import styles from './ModalRoot.scss'
const MODAL_COMPONENTS = {
SUCCESSFUL_SEND_COINS: SuccessfulSendCoins,
SUCCESSFUL_SEND_PAYMENT: SuccessfulSendPayment,
WALLET_DETAILS: WalletDetails
/* other modals */
}
const ModalRoot = ({ modalType, modalProps, hideModal, currentTicker, currency }) => {
if (!modalType) { return null }
const SpecificModal = MODAL_COMPONENTS[modalType]
return (
<div className={styles.container}>
<div className={styles.content}>
<div className={styles.esc} onClick={hideModal}>
<FaClose />
</div>
<SpecificModal
{...modalProps}
hideModal={hideModal}
currentTicker={currentTicker}
currency={currency}
/>
</div>
</div>
)
}
ModalRoot.propTypes = {
modalType: PropTypes.string,
modalProps: PropTypes.object,
hideModal: PropTypes.func.isRequired,
currentTicker: PropTypes.object.isRequired,
currency: PropTypes.string.isRequired
}
export default ModalRoot