acud
Version:
acg react 组件库
233 lines (203 loc) • 5.79 kB
text/less
@import '../../style/themes/index';
@import '../../style/mixins/index';
@import './mixin';
@image-prefix-cls: ~'@{acud-prefix}-image';
@image-preview-prefix-cls: ~'@{image-prefix-cls}-preview';
.@{image-prefix-cls} {
position: relative;
display: inline-block;
&-img {
width: 100%;
height: auto;
vertical-align: middle;
&-placeholder {
background-color: @image-bg;
background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTQuNSAyLjVoLTEzQS41LjUgMCAwIDAgMSAzdjEwYS41LjUgMCAwIDAgLjUuNWgxM2EuNS41IDAgMCAwIC41LS41VjNhLjUuNSAwIDAgMC0uNS0uNXpNNS4yODEgNC43NWExIDEgMCAwIDEgMCAyIDEgMSAwIDAgMSAwLTJ6bTguMDMgNi44M2EuMTI3LjEyNyAwIDAgMS0uMDgxLjAzSDIuNzY5YS4xMjUuMTI1IDAgMCAxLS4wOTYtLjIwN2wyLjY2MS0zLjE1NmEuMTI2LjEyNiAwIDAgMSAuMTc3LS4wMTZsLjAxNi4wMTZMNy4wOCAxMC4wOWwyLjQ3LTIuOTNhLjEyNi4xMjYgMCAwIDEgLjE3Ny0uMDE2bC4wMTUuMDE2IDMuNTg4IDQuMjQ0YS4xMjcuMTI3IDAgMCAxLS4wMi4xNzV6IiBmaWxsPSIjOEM4QzhDIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L3N2Zz4=');
background-repeat: no-repeat;
background-position: center center;
background-size: 30%;
}
}
&-mask {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: flex;
align-items: center;
justify-content: center;
color: @image-text-color-inverse;
background: @image-mask-bg;
cursor: pointer;
opacity: 0;
transition: opacity @animation-duration-slow;
&-info {
padding: 0 @padding-xss;
font-size: @image-font-size-base;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
.@{iconfont-css-prefix} {
margin-inline-end: @margin-xss;
}
}
&:hover {
opacity: 1;
}
}
&-placeholder {
.box();
}
&-preview {
.modal-mask();
height: 100%;
text-align: center;
&-close {
position: fixed;
top: @image-preview-close-position;
right: @image-preview-close-position;
color: @image-text-color-inverse;
display: flex;
justify-content: center;
align-items: center;
background-color: fade(@image-modal-mask-bg, 10%);
border-radius: 50%;
width: @image-preview-btn-size;
height: @image-preview-btn-size;
outline: 0;
border: 0;
cursor: pointer;
transition: all 0.3s;
}
&-body {
.box();
overflow: hidden;
}
&-footer {
position: fixed;
bottom: @image-preview-footer-bottom;
left: 50%;
display: flex;
flex-direction: column;
align-items: center;
color: rgba(255,255,255,0.65);
transform: translateX(-50%);
}
&-img {
max-width: 100%;
max-height: 100%;
vertical-align: middle;
transform: scale3d(1, 1, 1);
cursor: grab;
transition: transform 0.3s @ease-out 0s;
user-select: none;
pointer-events: auto;
&-wrapper {
.box();
transition: transform 0.3s @ease-out 0s;
&::before {
display: inline-block;
width: 1px;
height: 50%;
margin-right: -1px;
content: '';
}
}
}
&-moving {
.@{image-prefix-cls}-preview-img {
cursor: grabbing;
&-wrapper {
transition-duration: 0s;
}
}
}
&-wrap {
z-index: @zindex-image;
}
&-operations-wrapper {
position: fixed;
top: 0;
right: 0;
z-index: @zindex-image + 1;
width: 100%;
}
&-operations {
.reset-component();
color: @image-text-color-inverse;
display: flex;
align-items: center;
padding: 0 @image-control-padding-horizontal;
background-color: rgba(0, 0, 0, 0.1);
border-radius: @image-preview-operation-radius;
&-operation {
margin-left: @image-control-padding-horizontal;
padding: @image-control-padding-horizontal;
cursor: pointer;
transition: all 0.3s;
.@{iconfont-css-prefix} {
font-size: @image-preview-operation-size;
}
&:hover {
background: fade(@image-modal-mask-bg, 20%);
}
&-disabled {
color: @image-preview-operation-disabled-color;
pointer-events: none;
}
&:last-of-type {
margin-left: 0;
}
}
&-progress {
position: absolute;
left: 50%;
transform: translateX(-50%);
}
&-icon {
font-size: @image-preview-operation-size;
}
}
&-switch-left,
&-switch-right {
position: fixed;
top: 50%;
right: @image-preview-switch-position;
z-index: @zindex-image + 1;
display: flex;
align-items: center;
justify-content: center;
width: @image-preview-btn-size;
height: @image-preview-btn-size;
color: @image-preview-operation-color;
background: fade(@image-modal-mask-bg, 10%);
border-radius: 50%;
transform: translateY(-50%);
cursor: pointer;
transition: all 0.3s;
pointer-events: auto;
&:hover {
background: fade(@image-modal-mask-bg, 20%);
}
&-disabled,
&-disabled:hover {
color: @image-preview-operation-disabled-color;
background: fade(@image-modal-mask-bg, 10%);
cursor: not-allowed;
> .@{iconfont-css-prefix} {
cursor: not-allowed;
}
}
> .@{iconfont-css-prefix} {
font-size: @image-preview-operation-size;
}
}
&-switch-left {
left: @image-preview-switch-position;
}
&-switch-right {
right: @image-preview-switch-position;
}
}
}