amis/scss/components/_modal.scss

232 lines
4.4 KiB
SCSS
Raw Normal View History

2019-04-30 11:11:25 +08:00
.is-modalOpened {
2019-12-06 09:58:08 +08:00
overflow: hidden;
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
.#{$ns}Modal {
overflow-x: hidden;
overflow-y: auto;
}
2019-04-30 11:11:25 +08:00
}
@keyframes modalIn {
2019-12-06 09:58:08 +08:00
from {
opacity: 0;
transform: translate3d(0, -300px, 0) scale(0.2);
}
}
@keyframes modalOut {
2019-12-06 09:58:08 +08:00
to {
opacity: 0;
transform: translate3d(0, -300px, 0) scale(0.2);
}
}
2019-04-30 11:11:25 +08:00
.#{$ns}Modal {
2019-12-06 09:58:08 +08:00
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: $zindex-modal;
overflow: hidden;
outline: 0;
&-content {
position: relative;
display: flex;
flex-direction: column;
width: 100%; // Ensure `.modal-content` extends the full width of the parent `.modal-dialog`
min-height: $Modal-content-minHeight;
pointer-events: auto;
background-color: $Modal-bg;
background-clip: padding-box;
outline: 0;
z-index: 2;
margin-left: auto;
margin-right: auto;
margin-top: $Modal-content-startMarginTop;
margin-bottom: $gap-md;
border: $Modal-content-borderWidth solid $Modal-content-borderColor;
border-radius: $Modal-content-borderRadius;
// transition: ease-out all 0.3s;
// transform: translateY(-300px) scale(0.2);
// opacity: 0;
&.in,
&.out {
// opacity: 1;
// transform: translateY(0) scale(1);
animation-duration: 0.35s;
animation-fill-mode: both;
}
&.in {
animation-name: modalIn;
}
&.out {
animation-name: modalOut;
}
}
&-overlay {
transition: ease-in-out opacity 0.5s;
// transition-delay: 0.2s;
2019-04-30 11:11:25 +08:00
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
2019-12-06 09:58:08 +08:00
z-index: 1;
background-color: $Modal-overlay-bg;
opacity: 0;
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&.in {
opacity: 1;
}
2019-12-06 09:58:08 +08:00
&.out {
opacity: 0;
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&-header {
padding: $Modal-header-paddingY $Modal-header-paddingX;
background-color: $Modal-header-bg;
@include clearfix();
border-bottom: $Modal-body-borderTop;
2019-10-31 10:35:24 +08:00
2019-12-06 09:58:08 +08:00
@if $Modal-content-borderRadius {
border-top-left-radius: $Modal-content-borderRadius;
border-top-right-radius: $Modal-content-borderRadius;
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&-title {
font-size: $Modal-title-fontSize;
color: $Modal-title-color;
}
2019-12-06 09:58:08 +08:00
&-close {
float: right;
color: $Modal-close-color;
line-height: inherit;
text-decoration: none;
vertical-align: middle;
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
svg {
width: $Modal-close-width;
height: $Modal-close-width;
fill: $Modal-close-color;
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
&:not(.is-disabled) {
cursor: pointer;
&:hover {
2019-04-30 11:11:25 +08:00
text-decoration: none;
2019-12-06 09:58:08 +08:00
color: $Model-close-onHover-color;
2019-04-30 11:11:25 +08:00
svg {
2019-12-06 09:58:08 +08:00
fill: $Model-close-onHover-color;
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
}
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&-content > &-close {
position: absolute;
right: $gap-md;
top: $gap-sm;
z-index: 10;
}
2019-12-06 09:58:08 +08:00
&-body {
padding: $Modal-body--noHeader-paddingTop $Modal-body-paddingX
$Modal-body-paddingY;
flex-basis: 0;
flex-grow: 1;
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&-header + &-body {
padding-top: $Modal-body-paddingY;
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&-footer {
// @include clearfix();
display: flex;
align-items: center;
justify-content: flex-end;
padding: $Modal-footer-padding;
border-top: $Modal-body-borderBottom;
margin: $Modal-footer-marginY $Modal-footer-marginX;
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
@if $Modal-content-borderRadius {
border-bottom-left-radius: $Modal-content-borderRadius;
border-bottom-right-radius: $Modal-content-borderRadius;
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
.#{$ns}Button {
margin-left: $gap-sm;
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
}
@for $i from (2) through 10 {
2019-12-06 09:58:08 +08:00
.#{$ns}Modal--#{$i}th {
.#{$ns}Modal-content {
margin-top: $Modal-content-startMarginTop +
($i - 1) *
$Modal-content-stepMarginTop;
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
}
@include media-breakpoint-up(sm) {
2019-12-06 09:58:08 +08:00
.#{$ns}Modal-content {
max-width: $Modal-widthBase;
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
.#{$ns}Modal--sm .#{$ns}Modal-content {
max-width: $Modal-widthSm;
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
.#{$ns}Modal--base .#{$ns}Modal-content {
max-width: $Modal-widthBase;
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
.#{$ns}Modal--md .#{$ns}Modal-content {
max-width: $Modal-widthMd;
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
.#{$ns}Modal--lg .#{$ns}Modal-content {
max-width: $Modal-widthLg;
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
.#{$ns}Modal--xl .#{$ns}Modal-content {
max-width: $Modal-widthXl;
}
2019-04-30 11:11:25 +08:00
}
.#{$ns}Dialog-info {
2019-12-06 09:58:08 +08:00
flex-basis: 0;
flex-grow: 1;
text-align: left;
2019-04-30 11:11:25 +08:00
}
.#{$ns}Dialog-error {
2019-12-06 09:58:08 +08:00
color: $danger;
}
2019-12-31 15:39:21 +08:00
.#{$ns}Modal--full .#{$ns}Modal-content {
width: calc(100% - 60px);
height: calc(100% - 60px);
max-width: unset;
margin: px2rem(30px);
.#{$ns}Modal-body {
overflow: auto;
}
}