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

112 lines
1.9 KiB
SCSS
Raw Normal View History

2018-08-14 21:12:30 +02:00
@import 'variables';
.modal {
2019-10-02 13:35:50 +02:00
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;
2018-08-14 21:12:30 +02:00
2019-10-02 13:35:50 +02:00
@media (min-width: $screen-sm) {
display: flex;
align-items: flex-start;
justify-content: center;
padding-top: 6vh;
}
2018-08-14 21:12:30 +02:00
}
.modal__content {
2019-10-02 13:35:50 +02:00
outline: 0;
background: transparent;
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%;
2018-08-14 21:12:30 +02:00
2019-10-02 13:35:50 +02:00
@media (min-width: $screen-md) {
max-width: $screen-sm;
padding: 0 $spacer $spacer;
}
2018-08-14 21:12:30 +02:00
}
.modal__close {
2019-10-02 13:35:50 +02:00
display: block;
cursor: pointer;
background: transparent;
border: 0;
appearance: none;
line-height: 1;
font-size: $font-size-h2;
padding: 4px;
position: absolute;
top: 0;
right: ($spacer/4);
color: $brand-grey-light;
font-weight: 500;
outline: 0;
2018-10-13 18:13:36 +02:00
2019-10-02 13:35:50 +02:00
&:hover,
&:focus {
color: $brand-grey;
}
2018-08-14 21:12:30 +02:00
}
.isModalOpen {
2019-10-02 13:35:50 +02:00
// Prevent background scrolling when modal is open
overflow: hidden;
2018-10-13 18:13:36 +02:00
2019-10-02 13:35:50 +02:00
// more cross-browser backdrop-filter
// body > div:first-child {
// transition: filter .85s ease-out;
// filter: blur(5px);
// }
2018-08-14 21:12:30 +02:00
}
.modal__title {
2019-10-02 13:35:50 +02:00
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);
2018-08-14 21:12:30 +02:00
2019-10-02 13:35:50 +02:00
@media (min-width: $screen-md) {
margin-left: -($spacer);
margin-right: -($spacer);
}
2018-08-14 21:12:30 +02:00
}
//
// Overlay/content animations
//
@keyframes fadein {
2019-10-02 13:35:50 +02:00
0% {
opacity: 0;
}
2018-08-14 21:12:30 +02:00
2019-10-02 13:35:50 +02:00
100% {
opacity: 1;
}
2018-08-14 21:12:30 +02:00
}
@keyframes fadeout {
2019-10-02 13:35:50 +02:00
0% {
opacity: 1;
}
2018-08-14 21:12:30 +02:00
2019-10-02 13:35:50 +02:00
100% {
opacity: 0;
}
2018-08-14 21:12:30 +02:00
}