Skip to content

Instantly share code, notes, and snippets.

@patrickml
Last active October 16, 2015 01:39
Show Gist options
  • Save patrickml/9c1bcbe207100cf4b2dd to your computer and use it in GitHub Desktop.
Save patrickml/9c1bcbe207100cf4b2dd to your computer and use it in GitHub Desktop.
Meteor.startup(function () {
var body = $('body');
body.on('click', '.md-trigger', function (event) {
$( '#' + $(event.currentTarget).attr( 'data-modal' ) ).addClass('md-show');
body.addClass('modal');
});
body.on('click', '.md-overlay, .md-close', function (event) {
body.removeClass('modal');
$('.md-show').removeClass('md-show');
});
body.prepend("<div class='md-overlay'></div>");
});
Modal = React.createClass({
render () {
return (
<div className="md-modal md-effect-1" id="modal-1">
<div className="md-content">
<h3>{this.props.title}</h3>
<div className="md-body">
{this.props.content}
<i className="md-close close ion ion-close"></i>
</div>
</div>
</div>
)
}
});
.md-modal {
position: fixed;
top: 50%;
left: 50%;
width: 50%;
max-width: 630px;
min-width: 320px;
height: auto;
z-index: 2000;
visibility: hidden;
backface-visibility: hidden;
transform: translateX(-50%) translateY(-50%);
}
.md-show {
visibility: visible;
}
.md-overlay {
position: fixed;
width: 100%;
height: 100%;
visibility: hidden;
top: 0;
left: 0;
z-index: 1000;
opacity: 0;
background: rgba(74, 133, 212, 0.57);
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
transition: all 0.3s;
}
.modal .md-overlay {
opacity: 1;
visibility: visible;
}
.md-content {
color: #fff;
background: $primary-color;
position: relative;
border-radius: 3px;
margin: 0 auto;
h3 {
margin: 0;
padding: 0.4em;
text-align: center;
font-size: 2.4em;
font-weight: 300;
opacity: 0.8;
background: rgba(0, 0, 0, 0.1);
border-radius: 3px 3px 0 0;
}
.md-body {
padding: 15px 40px 30px;
margin: 0;
font-weight: 300;
font-size: 1.15em;
}
.close {
position: absolute;
top: -31px;
right: 0;
border: solid 1px #fff;
width: 25px;
height: 25px;
text-align: center;
line-height: 25px;
border-radius: 360px;
cursor: pointer;
}
button {
border: none;
padding: 0.6em 1.2em;
background: $primary-color;
color: #fff;
font-family: 'Open Sans', Calibri, Arial, sans-serif;
font-size: 1em;
letter-spacing: 1px;
text-transform: uppercase;
cursor: pointer;
display: inline-block;
margin: 3px 2px;
border-radius: 2px;
&:focus {
outline: 0;
}
}
}
.md-effect-1 .md-content {
-webkit-transform: scale(0.7);
-moz-transform: scale(0.7);
-ms-transform: scale(0.7);
transform: scale(0.7);
opacity: 0;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
transition: all 0.3s;
}
.md-show.md-effect-1 .md-content {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
opacity: 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment