1
0
Fork 0
blog/src/components/atoms/Modal.module.scss

125 lines
2.2 KiB
SCSS

@import 'variables';
.modal {
position: fixed;
overflow: auto;
-webkit-overflow-scrolling: touch;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 9;
background: rgba($body-background-color, 0.95);
backdrop-filter: blur(5px);
animation: fadein 0.3s;
padding: $spacer;
:global(.dark) & {
background: rgba($body-background-color--dark, 0.95);
}
@media (min-width: $screen-sm) {
display: flex;
align-items: flex-start;
justify-content: center;
padding-top: 6vh;
}
}
.modalContent {
outline: 0;
background: $body-background-color;
position: relative;
border-radius: $border-radius;
border: 1px solid rgba($brand-grey-light, 0.4);
box-shadow: 0 5px 30px rgba($brand-grey-light, 0.2);
padding: 0 $spacer / 2 $spacer / 2;
max-width: 100%;
:global(.dark) & {
background: $body-background-color--dark;
box-shadow: 0 5px 30px rgba(darken($brand-main, 20%), 0.5);
}
@media (min-width: $screen-md) {
max-width: $screen-sm;
padding: 0 $spacer $spacer;
}
}
.modalClose {
display: block;
cursor: pointer;
background: transparent;
border: 0;
appearance: none;
padding: 4px;
position: absolute;
top: $spacer / 4;
right: ($spacer/4);
outline: 0;
svg {
width: 24px;
height: 24px;
stroke: $brand-grey-light;
}
&:hover,
&:focus {
svg {
stroke: $brand-cyan;
}
}
}
.isModalOpen {
// Prevent background scrolling when modal is open
overflow: hidden;
// more cross-browser backdrop-filter
// body > div:first-child {
// transition: filter .85s ease-out;
// filter: blur(5px);
// }
}
.modalTitle {
font-size: $font-size-h4;
margin-top: $spacer / 2;
margin-bottom: $spacer / 2;
margin-left: -($spacer / 2);
margin-right: -($spacer / 2);
border-bottom: 1px solid rgba($brand-grey-light, 0.4);
padding: 0 $spacer;
padding-bottom: ($spacer/2);
@media (min-width: $screen-md) {
margin-left: -($spacer);
margin-right: -($spacer);
}
}
//
// Overlay/content animations
//
@keyframes fadein {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@keyframes fadeout {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}