Add a modal component, extending react-modal

Also fix some z-index quirks
This commit is contained in:
Ray Schamp 2015-09-09 22:15:16 -04:00
parent 4a43d23720
commit 27fc9ff012
4 changed files with 74 additions and 0 deletions

View file

@ -37,6 +37,7 @@
"jsx-loader": "0.13.2",
"node-sass": "3.3.2",
"react": "0.13.3",
"react-modal": "0.3.0",
"react-slick": "0.7.0",
"sass-loader": "2.0.1",
"slick-carousel": "1.5.8",

View file

@ -0,0 +1,22 @@
var React = require('react');
var Modal = require('react-modal');
require('./modal.scss');
module.exports = React.createClass({
statics: {
setAppElement: Modal.setAppElement
},
requestClose: function() {
return this.refs.modal.portal.requestClose();
},
render: function() {
return (
<Modal ref='modal' {... this.props}>
<div className='modal-close' onClick={this.requestClose}></div>
{this.props.children}
</Modal>
);
}
});

View file

@ -0,0 +1,50 @@
/* Copied from the un-styleable react-modal */
.ReactModal__Overlay {
background-color: rgba(0, 0, 0, 0.75);
z-index: 100;
}
.ReactModal__Content {
position: absolute;
top: 40px;
left: 40px;
right: 40px;
bottom: 40px;
background: #fff;
overflow: visible;
-webkit-overflow-scrolling: touch;
border-radius: 6px;
outline: none;
padding: 20px;
}
@media (max-width: 768px) {
.ReactModal__Content {
top: 10px;
left: 10px;
right: 10px;
bottom: 10px;
padding: 10px;
}
}
.modal-close {
$modal-close-size: 20px;
position: absolute;
right: 0;
top: 0;
border-radius: $modal-close-size/2;
border: 2px solid #ddd;
background-color: #666;
color: #fff;
width: $modal-close-size;
height: $modal-close-size;
margin-top: -$modal-close-size/2;
margin-right: -$modal-close-size/2;
text-align: center;
line-height: $modal-close-size;
font-size: $modal-close-size;
cursor: pointer;
&:before {
content: "x";
}
}

View file

@ -1,5 +1,6 @@
#navigation {
position: fixed;
z-index: 10;
display: block;
top: 0;
left: 0;