amis2/scss/components/_drawer.scss

348 lines
7.0 KiB
SCSS
Raw Normal View History

2019-04-30 11:11:25 +08:00
.#{$ns}Drawer {
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: absolute;
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
pointer-events: auto;
background: var(--Drawer-bg);
2019-12-06 09:58:08 +08:00
background-clip: padding-box;
outline: 0;
z-index: 2;
border: var(--Drawer-content-borderWidth) solid
var(--Drawer-content-borderColor);
border-radius: var(--Drawer-content-borderRadius);
transition: transform ease-in-out var(--animation-duration);
2019-12-06 09:58:08 +08:00
}
&-overlay {
transition: ease-out opacity var(--animation-duration);
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: var(--Drawer-overlay-bg);
2019-12-06 09:58:08 +08:00
opacity: 0;
&.in {
opacity: 1;
}
}
&-header {
padding: var(--Drawer-header-padding);
background: var(--Drawer-header-bg);
2019-12-06 09:58:08 +08:00
@include clearfix();
border-bottom: var(--Drawer-content-borderWidth) solid
var(--Drawer-header-borderColor);
border-top-left-radius: var(--Drawer-content-borderRadius);
border-top-right-radius: var(--Drawer-content-borderRadius);
2019-12-06 09:58:08 +08:00
}
&-title {
font-size: var(--Drawer-title-fontSize);
color: var(--Drawer-title-fontColor);
2019-12-06 09:58:08 +08:00
}
&-close {
position: absolute;
color: var(--Drawer-close-color);
2019-12-06 09:58:08 +08:00
line-height: 1;
text-decoration: none;
svg {
width: 30px;
height: 30px;
fill: var(--Drawer-close-color);
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;
color: var(--Drawer-close-onHover-color);
2019-04-30 11:11:25 +08:00
svg {
fill: var(--Drawer-close-onHover-color);
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
}
}
&-body {
padding: var(--Drawer-body-padding);
2019-12-06 09:58:08 +08:00
flex-basis: 0;
flex-grow: 1;
overflow: auto;
}
&-footer {
display: flex;
align-items: flex-end;
justify-content: flex-end;
padding: var(--Drawer-footer-padding);
border-top: var(--Drawer-content-borderWidth) solid
var(--Drawer-footer-borderColor);
border-bottom-left-radius: var(--Drawer-content-borderRadius);
border-bottom-right-radius: var(--Drawer-content-borderRadius);
2019-12-06 09:58:08 +08:00
.#{$ns}Button {
margin-left: var(--gap-xs);
2019-12-06 09:58:08 +08:00
}
.#{$ns}Drawer-info {
flex-basis: 0;
flex-grow: 1;
text-align: left;
align-self: center;
}
.#{$ns}Drawer-error {
color: var(--danger);
white-space: pre-wrap;
2019-12-06 09:58:08 +08:00
}
}
&.#{$ns}Drawer--noOverlay {
2020-05-08 20:05:36 +08:00
pointer-events: none;
2019-12-06 09:58:08 +08:00
.#{$ns}Drawer-close svg {
margin-top: px2rem(2px);
width: var(--gap-md);
height: var(--gap-md);
2019-12-06 09:58:08 +08:00
fill: #99a6ad;
}
}
.#{$ns}Drawer-resizeCtrl {
position: absolute;
border: var(--borderWidth) solid var(--borderColor);
background: var(--white);
border-radius: var(--borderRadius);
font-size: var(--fontSizeSm);
line-height: px2rem(10px);
2019-12-06 09:58:08 +08:00
text-align: center;
user-select: none;
}
2019-04-30 11:11:25 +08:00
}
// size
@include media-breakpoint-up(sm) {
2019-12-06 09:58:08 +08:00
.#{$ns}Drawer .#{$ns}Drawer-content {
width: var(--Drawer-widthBase);
height: var(--Drawer-widthBase);
2019-12-06 09:58:08 +08:00
}
.#{$ns}Drawer--xs .#{$ns}Drawer-content {
width: var(--Drawer-widthXs);
height: var(--Drawer-widthXs);
2019-12-06 09:58:08 +08:00
}
.#{$ns}Drawer--sm .#{$ns}Drawer-content {
width: var(--Drawer-widthSm);
height: var(--Drawer-widthSm);
2019-12-06 09:58:08 +08:00
}
.#{$ns}Drawer--md .#{$ns}Drawer-content {
width: var(--Drawer-widthMd);
height: var(--Drawer-widthMd);
2019-12-06 09:58:08 +08:00
}
.#{$ns}Drawer--lg .#{$ns}Drawer-content {
width: var(--Drawer-widthLg);
height: var(--Drawer-widthLg);
2019-12-06 09:58:08 +08:00
}
.#{$ns}Drawer--xl .#{$ns}Drawer-content {
width: var(--Drawer-widthXl);
height: var(--Drawer-widthXl);
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
}
// positons
.#{$ns}Drawer--top .#{$ns}Drawer-content.in,
.#{$ns}Drawer--right .#{$ns}Drawer-content.in,
.#{$ns}Drawer--bottom .#{$ns}Drawer-content.in,
.#{$ns}Drawer--left .#{$ns}Drawer-content.in {
2019-12-06 09:58:08 +08:00
transform: translate3d(0, 0, 0);
2019-04-30 11:11:25 +08:00
}
.#{$ns}Drawer--top {
2019-12-06 09:58:08 +08:00
.#{$ns}Drawer-close {
top: 100%;
margin-top: var(--gap-sm);
left: var(--gap-sm);
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&.#{$ns}Drawer--noOverlay {
.#{$ns}Drawer-close {
top: var(--gap-base);
right: var(--gap-base);
2019-12-06 09:58:08 +08:00
left: auto;
margin-top: 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
.#{$ns}Drawer-content {
top: 0;
bottom: auto;
left: 0;
right: 0;
width: 100%;
transform: translate3d(0, -100%, 0);
box-shadow: 0 10px 10px -10px rgba(0, 0, 0, 0.2);
min-height: 120px;
}
.#{$ns}Drawer-resizeCtrl {
bottom: px2rem(-6px);
left: 50%;
cursor: ns-resize;
width: px2rem(24px);
2019-12-06 09:58:08 +08:00
height: px2rem(12px);
}
2019-04-30 11:11:25 +08:00
}
.#{$ns}Drawer--right {
2019-12-06 09:58:08 +08:00
.#{$ns}Drawer-close {
right: 100%;
margin-right: var(--gap-sm);
top: var(--gap-sm);
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&.#{$ns}Drawer--noOverlay {
.#{$ns}Drawer-close {
top: var(--gap-base);
right: var(--gap-base);
2019-12-06 09:58:08 +08:00
margin-right: 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
.#{$ns}Drawer-content {
top: 0;
bottom: 0;
left: auto;
right: 0;
height: 100%;
transform: translate3d(100%, 0, 0);
box-shadow: -10px 0 10px -10px rgba(0, 0, 0, 0.2);
min-width: 120px;
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
.#{$ns}Drawer-footer {
justify-content: flex-start;
2019-07-17 10:16:40 +08:00
2019-12-06 09:58:08 +08:00
.#{$ns}Button {
margin-left: 0;
margin-right: var(--gap-xs);
2019-12-06 09:58:08 +08:00
}
2019-07-17 10:16:40 +08:00
2019-12-06 09:58:08 +08:00
.#{$ns}Drawer-info {
flex-basis: 0;
flex-grow: 1;
order: 10;
align-self: center;
text-align: right;
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
.#{$ns}Drawer-error {
color: var(--danger);
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
.#{$ns}Drawer-resizeCtrl {
left: px2rem(-6px);
top: 50%;
cursor: ew-resize;
writing-mode: vertical-lr;
width: px2rem(12px);
height: px2rem(24px);
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
}
.#{$ns}Drawer--bottom {
2019-12-06 09:58:08 +08:00
.#{$ns}Drawer-close {
bottom: 100%;
margin-bottom: var(--gap-sm);
left: var(--gap-sm);
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&.#{$ns}Drawer--noOverlay {
.#{$ns}Drawer-close {
top: var(--gap-base);
right: var(--gap-base);
2019-12-06 09:58:08 +08:00
left: auto;
margin-bottom: 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
.#{$ns}Drawer-content {
top: auto;
bottom: 0;
left: 0;
right: 0;
width: 100%;
transform: translate3d(0, 100%, 0);
box-shadow: 0 -10px 10px -10px rgba(0, 0, 0, 0.2);
min-height: 120px;
}
.#{$ns}Drawer-resizeCtrl {
top: px2rem(-6px);
left: 50%;
cursor: ns-resize;
width: px2rem(24px);
2019-12-06 09:58:08 +08:00
height: px2rem(12px);
}
2019-04-30 11:11:25 +08:00
}
.#{$ns}Drawer--left {
2019-12-06 09:58:08 +08:00
.#{$ns}Drawer-close {
left: 100%;
margin-left: var(--gap-sm);
top: var(--gap-sm);
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&.#{$ns}Drawer--noOverlay {
.#{$ns}Drawer-close {
left: auto;
right: var(--gap-base);
top: var(--gap-base);
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
.#{$ns}Drawer-content {
top: 0;
bottom: 0;
right: auto;
left: 0;
height: 100%;
transform: translate3d(-100%, 0, 0);
box-shadow: 10px 0 10px -10px rgba(0, 0, 0, 0.2);
border-width: 0 var(--Drawer-content-borderWidth) 0 0;
2019-12-06 09:58:08 +08:00
min-width: 120px;
}
.#{$ns}Drawer-resizeCtrl {
right: px2rem(-6px);
top: 50%;
cursor: ew-resize;
writing-mode: vertical-lr;
width: px2rem(12px);
height: px2rem(24px);
2019-12-06 09:58:08 +08:00
}
}