Browse Source
Given we have no active use of it, and the trend seems to be toward independent modal components, eg. ContactModal, let's drop it.renovate/lint-staged-8.x
8 changed files with 0 additions and 181 deletions
@ -1,44 +0,0 @@ |
|||||
import React from 'react' |
|
||||
import PropTypes from 'prop-types' |
|
||||
import { MdClose } from 'react-icons/lib/md' |
|
||||
import styles from './ModalRoot.scss' |
|
||||
|
|
||||
const MODAL_COMPONENTS = { |
|
||||
/* other modals */ |
|
||||
} |
|
||||
|
|
||||
const ModalRoot = ({ |
|
||||
modalType, modalProps, hideModal, currentTicker, currency, isTestnet |
|
||||
}) => { |
|
||||
if (!modalType) { return null } |
|
||||
|
|
||||
const SpecificModal = MODAL_COMPONENTS[modalType] |
|
||||
return ( |
|
||||
<div className={styles.container}> |
|
||||
<div className={styles.content}> |
|
||||
<div className={styles.esc} onClick={hideModal}> |
|
||||
<MdClose /> |
|
||||
</div> |
|
||||
|
|
||||
<SpecificModal |
|
||||
{...modalProps} |
|
||||
hideModal={hideModal} |
|
||||
currentTicker={currentTicker} |
|
||||
currency={currency} |
|
||||
isTestnet={isTestnet} |
|
||||
/> |
|
||||
</div> |
|
||||
</div> |
|
||||
) |
|
||||
} |
|
||||
|
|
||||
ModalRoot.propTypes = { |
|
||||
modalType: PropTypes.string, |
|
||||
modalProps: PropTypes.object, |
|
||||
hideModal: PropTypes.func.isRequired, |
|
||||
currentTicker: PropTypes.object.isRequired, |
|
||||
currency: PropTypes.string.isRequired, |
|
||||
isTestnet: PropTypes.bool.isRequired |
|
||||
} |
|
||||
|
|
||||
export default ModalRoot |
|
@ -1,43 +0,0 @@ |
|||||
@import '../../variables.scss'; |
|
||||
|
|
||||
.container { |
|
||||
position: absolute; |
|
||||
top: 0; |
|
||||
left: 0; |
|
||||
width: 100%; |
|
||||
height: 100%; |
|
||||
z-index: 10; |
|
||||
background: $spaceblue; |
|
||||
} |
|
||||
|
|
||||
.content { |
|
||||
position: relative; |
|
||||
height: 100vh; |
|
||||
margin: 5%; |
|
||||
color: $white; |
|
||||
} |
|
||||
|
|
||||
.esc { |
|
||||
position: absolute; |
|
||||
top: 0; |
|
||||
right: 0; |
|
||||
color: $darkestgrey; |
|
||||
cursor: pointer; |
|
||||
padding: 20px; |
|
||||
border-radius: 50%; |
|
||||
|
|
||||
&:hover { |
|
||||
color: $bluegrey; |
|
||||
background: $darkgrey; |
|
||||
} |
|
||||
|
|
||||
&:active { |
|
||||
color: $white; |
|
||||
background: $gold; |
|
||||
} |
|
||||
|
|
||||
svg { |
|
||||
width: 32px; |
|
||||
height: 32px; |
|
||||
} |
|
||||
} |
|
@ -1,3 +0,0 @@ |
|||||
import ModalRoot from './ModalRoot' |
|
||||
|
|
||||
export default ModalRoot |
|
@ -1,47 +0,0 @@ |
|||||
// ------------------------------------
|
|
||||
// Initial State
|
|
||||
// ------------------------------------
|
|
||||
const initialState = { |
|
||||
modalType: null, |
|
||||
modalProps: {} |
|
||||
} |
|
||||
|
|
||||
// ------------------------------------
|
|
||||
// Constants
|
|
||||
// ------------------------------------
|
|
||||
export const SHOW_MODAL = 'SHOW_MODAL' |
|
||||
export const HIDE_MODAL = 'HIDE_MODAL' |
|
||||
|
|
||||
// ------------------------------------
|
|
||||
// Actions
|
|
||||
// ------------------------------------
|
|
||||
export function showModal(modalType, modalProps) { |
|
||||
return { |
|
||||
type: SHOW_MODAL, |
|
||||
modalType, |
|
||||
modalProps |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
export function hideModal() { |
|
||||
return { |
|
||||
type: HIDE_MODAL |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
// ------------------------------------
|
|
||||
// Action Handlers
|
|
||||
// ------------------------------------
|
|
||||
const ACTION_HANDLERS = { |
|
||||
[SHOW_MODAL]: (state, { modalType, modalProps }) => ({ ...state, modalType, modalProps }), |
|
||||
[HIDE_MODAL]: () => initialState |
|
||||
} |
|
||||
|
|
||||
// ------------------------------------
|
|
||||
// Reducer
|
|
||||
// ------------------------------------
|
|
||||
export default function modalReducer(state = initialState, action) { |
|
||||
const handler = ACTION_HANDLERS[action.type] |
|
||||
|
|
||||
return handler ? handler(state, action) : state |
|
||||
} |
|
@ -1,19 +0,0 @@ |
|||||
import React from 'react' |
|
||||
import { shallow } from 'enzyme' |
|
||||
import ModalRoot from '../../app/components/ModalRoot' |
|
||||
|
|
||||
const defaultProps = { |
|
||||
hideModal: () => {}, |
|
||||
modalProps: {}, |
|
||||
currentTicker: {}, |
|
||||
currency: '', |
|
||||
isTestnet: false |
|
||||
} |
|
||||
|
|
||||
describe('no modal', () => { |
|
||||
const props = { ...defaultProps } |
|
||||
const el = shallow(<ModalRoot {...props} />) |
|
||||
it('should return null', () => { |
|
||||
expect(el.html()).toBeNull() |
|
||||
}) |
|
||||
}) |
|
Loading…
Reference in new issue