public/sass/mixins/modal/modal.scss (30 lines of code) (raw):
@import "palette.scss";
@import "dimensions.scss";
@import "typography.scss";
@mixin modal {
//position
position: fixed;
top: 0;
left: 0;
//dimensions
width: 100%;
height: 100%;
//center children
display: flex;
justify-content: center;
align-items: center;
//hide it
opacity: 0;
pointer-events: none;
transition: opacity .2s ease-in;
&.open {
opacity: 1;
pointer-events: auto;
}
&:before {
content: ' ';
display: inline-block;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.2);
}
}