Skip to content

Instantly share code, notes, and snippets.

@dphaener
Created October 26, 2015 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dphaener/5197191b641e781a9cbc to your computer and use it in GitHub Desktop.
Save dphaener/5197191b641e781a9cbc to your computer and use it in GitHub Desktop.
Elemental UI Modal CSS
%modal_common {
margin-left: 20px;
margin-right: 20px;
padding-bottom: 20px;
padding-top: 20px;
position: relative;
}
@-webkit-keyframes modalDialogEnter {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes modalDialogEnter {
from {
opacity: 0;
//Instead of the line below you could use @include transform($scale, $rotate, $transx, $transy, $skewx, $skewy, $originx, $originy)
transform: scale(0.96);
}
to {
opacity: 1;
//Instead of the line below you could use @include transform($scale, $rotate, $transx, $transy, $skewx, $skewy, $originx, $originy)
transform: scale(1);
}
}
@-webkit-keyframes modalDialogLeave {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
@keyframes modalDialogLeave {
from {
opacity: 1;
//Instead of the line below you could use @include transform($scale, $rotate, $transx, $transy, $skewx, $skewy, $originx, $originy)
transform: scale(1);
}
to {
opacity: 0;
//Instead of the line below you could use @include transform($scale, $rotate, $transx, $transy, $skewx, $skewy, $originx, $originy)
transform: scale(0.8);
}
}
@-webkit-keyframes modalBackdropEnter {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes modalBackdropEnter {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@-webkit-keyframes modalBackdropLeave {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
@keyframes modalBackdropLeave {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
.Modal {
transition: visibility 140ms;
bottom: 0;
left: 0;
outline: 0;
overflow-x: hidden;
overflow-y: auto;
position: fixed;
right: 0;
top: 0;
visibility: hidden;
z-index: 110;
&.is-open {
transition: none;
visibility: visible;
}
}
.Modal-dialog {
padding: 10px;
position: relative;
width: auto;
z-index: 2;
}
.Modal-dialog-enter {
animation-name: modalDialogEnter;
animation-duration: 260ms;
animation-timing-function: cubic-bezier(0.5, -0.55, 0.4, 1.55);
}
.Modal-dialog-leave {
animation-duration: 140ms;
animation-name: modalDialogLeave;
}
.Modal-content {
background-color: $white;
border-radius: $base-border-radius;
box-shadow: 0 0 0 1px $black_175, 0 3px 8px $black_175;
outline: none;
position: relative;
}
@media(min-width: 768px) {
.Modal-dialog {
margin: 80px auto;
width: 768px;
}
}
.Modal__header {
@extend %modal_common;
box-shadow: 0 2px 0 lighten($brand-brown, 65%);
z-index: 1;
background: $white;
}
.Modal__body {
@extend %modal_common;
margin: 0;
padding: 20px;
background: $white;
}
.Modal__footer {
@extend %modal_common;
box-shadow: 0 -2px 0 lighten($brand-brown, 65%);
z-index: 1;
background: $white;
}
.Modal__header__text {
padding-left: 10px;
font-size: $base-font-size * 1.4;
font-weight: 400;
color: lighten($brand-green, 10);
line-height: 1;
margin: 0;
}
.Modal__header__close {
transition: opacity 140ms;
background: none;
border: none;
cursor: pointer;
line-height: 1em;
margin: 0;
opacity: 0.8;
font-size: 24px;
padding: 20px;
position: absolute;
right: -20px;
top: 0;
color: $brand-green;
text-shadow: none;
&:hover {
opacity: 1;
outline: 0;
background: none;
color: $brand-green;
}
&:focus {
opacity: 1;
outline: 0;
}
&:active {
color: $color_valencia_approx;
}
}
.Modal__header__close::after {
content: "\00d7";
}
.Modal-backdrop {
animation-duration: 140ms;
background-color: $black_50;
height: 100%;
left: 0;
position: fixed;
top: 0;
width: 100%;
z-index: 109;
}
.Modal-background-enter {
animation-name: modalBackdropEnter;
}
.Modal-background-leave {
animation-delay: 240ms;
animation-name: modalBackdropLeave;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment