UNPKG

4.07 kBtext/lessView Raw
1@import '../../style/themes/index';
2@import '../../style/mixins/index';
3
4@image-prefix-cls: ~'@{ant-prefix}-image';
5@image-preview-prefix-cls: ~'@{image-prefix-cls}-preview';
6
7.@{image-prefix-cls} {
8 position: relative;
9 display: inline-block;
10 &-img {
11 display: block;
12 width: 100%;
13 height: auto;
14 &-placeholder {
15 background-color: @image-bg;
16 background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTQuNSAyLjVoLTEzQS41LjUgMCAwIDAgMSAzdjEwYS41LjUgMCAwIDAgLjUuNWgxM2EuNS41IDAgMCAwIC41LS41VjNhLjUuNSAwIDAgMC0uNS0uNXpNNS4yODEgNC43NWExIDEgMCAwIDEgMCAyIDEgMSAwIDAgMSAwLTJ6bTguMDMgNi44M2EuMTI3LjEyNyAwIDAgMS0uMDgxLjAzSDIuNzY5YS4xMjUuMTI1IDAgMCAxLS4wOTYtLjIwN2wyLjY2MS0zLjE1NmEuMTI2LjEyNiAwIDAgMSAuMTc3LS4wMTZsLjAxNi4wMTZMNy4wOCAxMC4wOWwyLjQ3LTIuOTNhLjEyNi4xMjYgMCAwIDEgLjE3Ny0uMDE2bC4wMTUuMDE2IDMuNTg4IDQuMjQ0YS4xMjcuMTI3IDAgMCAxLS4wMi4xNzV6IiBmaWxsPSIjOEM4QzhDIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L3N2Zz4=);
17 background-repeat: no-repeat;
18 background-position: center center;
19 background-size: 30%;
20 }
21 }
22
23 &-mask {
24 position: absolute;
25 top: 0;
26 right: 0;
27 bottom: 0;
28 left: 0;
29 display: flex;
30 align-items: center;
31 justify-content: center;
32 color: @text-color-inverse;
33 background: fade(@black, 50%);
34 cursor: pointer;
35 opacity: 0;
36 transition: opacity @animation-duration-slow;
37
38 &-info {
39 .@{iconfont-css-prefix} {
40 margin-inline-end: @margin-xss;
41 }
42 }
43
44 &:hover {
45 opacity: 1;
46 }
47 }
48
49 &-placeholder {
50 .box();
51 }
52
53 &-preview {
54 .modal-mask();
55
56 height: 100%;
57 text-align: center;
58
59 &-body {
60 .box();
61 overflow: hidden;
62 }
63
64 &-img {
65 max-width: 100%;
66 max-height: 100%;
67 vertical-align: middle;
68 transform: scale3d(1, 1, 1);
69 cursor: grab;
70 transition: transform 0.3s @ease-out 0s;
71 user-select: none;
72 pointer-events: auto;
73 &-wrapper {
74 .box();
75 transition: transform 0.3s @ease-out 0s;
76 &::before {
77 display: inline-block;
78 width: 1px;
79 height: 50%;
80 margin-right: -1px;
81 content: '';
82 }
83 }
84 }
85
86 &-moving {
87 .@{image-prefix-cls}-preview-img {
88 cursor: grabbing;
89 &-wrapper {
90 transition-duration: 0s;
91 }
92 }
93 }
94
95 &-wrap {
96 z-index: @zindex-image;
97 }
98
99 &-operations {
100 .reset-component();
101 position: absolute;
102 top: 0;
103 right: 0;
104 z-index: 1;
105 display: flex;
106 flex-direction: row-reverse;
107 align-items: center;
108 width: 100%;
109 color: @image-preview-operation-color;
110 list-style: none;
111 background: fade(@modal-mask-bg, 10%);
112 pointer-events: auto;
113
114 &-operation {
115 margin-left: @control-padding-horizontal;
116 padding: @control-padding-horizontal;
117 cursor: pointer;
118 &-disabled {
119 color: @image-preview-operation-disabled-color;
120 pointer-events: none;
121 }
122 &:last-of-type {
123 margin-left: 0;
124 }
125 }
126 &-icon {
127 font-size: @image-preview-operation-size;
128 }
129 }
130
131 &-switch-left,
132 &-switch-right {
133 position: absolute;
134 top: 50%;
135 right: 10px;
136 z-index: 1;
137 display: flex;
138 align-items: center;
139 justify-content: center;
140 width: 44px;
141 height: 44px;
142 margin-top: -22px;
143 color: @image-preview-operation-color;
144 background: fade(@modal-mask-bg, 10%);
145 border-radius: 50%;
146 cursor: pointer;
147 pointer-events: auto;
148 &-disabled {
149 color: @image-preview-operation-disabled-color;
150 cursor: not-allowed;
151 > .@{iconfont-css-prefix} {
152 cursor: not-allowed;
153 }
154 }
155 > .@{iconfont-css-prefix} {
156 font-size: 18px;
157 }
158 }
159
160 &-switch-left {
161 left: 10px;
162 }
163
164 &-switch-right {
165 right: 10px;
166 }
167 }
168}