@fe6/water-pro
Version:
An enterprise-class UI design language and Vue-based implementation
203 lines (201 loc) • 3.92 kB
text/less
@ease-in-out-circ: cubic-bezier(0.78, 0.14, 0.15, 0.86);
@duration: 0.3s;
@drawer: drawer;
.@{drawer} {
position: fixed;
top: 0;
z-index: 9999;
> * {
transition: transform @duration @ease-in-out-circ, opacity @duration @ease-in-out-circ,
box-shaow @duration @ease-in-out-circ;
}
& &-mask {
position: fixed;
top: 0;
display: block ;
width: 0;
height: 0;
background: #000;
opacity: 0;
transition: opacity @duration @ease-in-out-circ, width 0s ease @duration,
height 0s ease @duration;
}
&-content-wrapper {
position: fixed;
background: #fff;
}
&-content {
position: relative;
z-index: 1;
overflow: auto;
}
&-handle {
position: absolute;
top: 72px;
z-index: 0;
display: flex;
align-items: center;
justify-content: center;
width: 41px;
height: 40px;
font-size: 16px;
line-height: 40px;
text-align: center;
background: #fff;
cursor: pointer;
&-icon {
position: relative;
width: 14px;
height: 2px;
background: #333;
transition: background @duration @ease-in-out-circ;
&::before,
&::after {
position: absolute;
display: block;
width: 100%;
height: 2px;
background: #333;
transition: transform @duration @ease-in-out-circ;
content: '';
}
&::before {
top: -5px;
}
&::after {
top: 5px;
}
}
}
&-left,
&-right {
width: 0%;
height: 100%;
.@{drawer}-content-wrapper,
.@{drawer}-content {
height: 100%;
}
&.@{drawer}-open {
width: 100%;
}
}
&-left {
.@{drawer} {
&-handle {
right: -40px;
border-radius: 0 4px 4px 0;
box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
}
}
&.@{drawer}-open {
.@{drawer} {
&-content-wrapper {
box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
}
}
}
}
&-right {
.@{drawer} {
&-content-wrapper {
right: 0;
}
&-handle {
left: -40px;
border-radius: 4px 0 0 4px;
box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
}
}
&.@{drawer}-open {
& .@{drawer} {
&-content-wrapper {
box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
}
}
}
}
&-top,
&-bottom {
width: 100%;
height: 0%;
.@{drawer}-content-wrapper,
.@{drawer}-content {
width: 100%;
}
.@{drawer} {
&-handle {
left: 50%;
margin-left: -20px;
}
}
&.@{drawer}-open {
height: 100%;
}
}
&-top {
.@{drawer} {
&-handle {
top: auto;
bottom: -40px;
border-radius: 0 0 4px 4px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
}
&.@{drawer}-open {
.@{drawer} {
&-wrapper {
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
}
}
}
&-bottom {
.@{drawer} {
&-content-wrapper {
bottom: 0;
}
&-handle {
top: -40px;
border-radius: 4px 4px 0 0;
box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
}
}
&.@{drawer}-open {
.@{drawer} {
&-content-wrapper {
box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
}
}
}
}
&.@{drawer}-open {
.@{drawer} {
&-mask {
width: 100%;
height: 100%;
opacity: 0.3;
transition: none;
animation: fadeIn 0.3s @ease-in-out-circ;
}
&-handle {
&-icon {
background: transparent;
&::before {
transform: translateY(5px) rotate(45deg);
}
&::after {
transform: translateY(-5px) rotate(-45deg);
}
}
}
}
}
}
@keyframes fadeIn {
0% {
opacity: 0;
}
100% {
opacity: 0.3;
}
}