diff --git a/opentech/apply/funds/api_views.py b/opentech/apply/funds/api_views.py index f4017549d73e23fa0304316b877b793ac9df1402..05ebfec9d193a1dda581a341d146fea73ba1c495 100644 --- a/opentech/apply/funds/api_views.py +++ b/opentech/apply/funds/api_views.py @@ -1,4 +1,5 @@ from django.core.exceptions import PermissionDenied as DjangoPermissionDenied +from django.db import transaction from django.db.models import Q from rest_framework import generics, permissions from rest_framework.response import Response diff --git a/opentech/static_src/src/app/src/components/Modal/index.js b/opentech/static_src/src/app/src/components/Modal/index.js new file mode 100644 index 0000000000000000000000000000000000000000..6551b5ba6691e847f9414f5d25cd6692392aaab6 --- /dev/null +++ b/opentech/static_src/src/app/src/components/Modal/index.js @@ -0,0 +1,37 @@ +import React from 'react'; +import PropTypes from 'prop-types'; + +export default class Modal extends React.Component { + static propTypes = { + heading: PropTypes.string, + content: PropTypes.node.isRequired, + visible: PropTypes.bool, + onClose: PropTypes.func, + } + + get styles() { + const { visible } = this.props; + const modalStyle = {}; + + if (!visible) { + modalStyle['display'] = 'none'; + } + + return { + modal: { + ...modalStyle + } + } + } + + render() { + const { content, heading, onClose } = this.props; + return ( + <div style={this.styles.modal}> + {onClose && <button onClick={onClose}>[X]</button>} + {heading && <h1>{heading}</h1>} + {content} + </div> + ); + } +}