amis/scss/components/_images.scss

116 lines
2.7 KiB
SCSS
Raw Normal View History

2019-12-24 14:30:31 +08:00
.#{$ns}Images {
display: flex;
flex-wrap: wrap;
margin: -$gap-xs;
&-item {
display: flex;
margin: $gap-xs;
}
}
.#{$ns}Image {
display: inline-block;
2020-01-06 19:32:12 +08:00
width: px2rem(120px);
2019-12-24 14:30:31 +08:00
border: $borderWidth solid $borderColor;
padding: $gap-xs;
&-thumb {
2020-01-06 19:32:12 +08:00
width: 100%;
2019-12-24 14:30:31 +08:00
height: px2rem(108px);
2020-01-06 19:32:12 +08:00
background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjIwMCIgaGVpZ2h0PSI0MDAiPgogICAgPGRlZnM+CiAgICAgICAgPHBhdHRlcm4gaWQ9ImdyaWQiIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CiAgICAgICAgICAgIDxyZWN0IGZpbGw9ImJsYWNrIiB4PSIwIiB5PSIwIiB3aWR0aD0iMTAiIGhlaWdodD0iMTAiIG9wYWNpdHk9IjAuMSIgLz4KICAgICAgICAgICAgPHJlY3QgZmlsbD0id2hpdGUiIHg9IjEwIiB5PSIwIiB3aWR0aD0iMTAiIGhlaWdodD0iMTAiIC8+CiAgICAgICAgICAgIDxyZWN0IGZpbGw9ImJsYWNrIiB4PSIxMCIgeT0iMTAiIHdpZHRoPSIxMCIgaGVpZ2h0PSIxMCIgb3BhY2l0eT0iMC4xIiAvPgogICAgICAgICAgICA8cmVjdCBmaWxsPSJ3aGl0ZSIgeD0iMCIgeT0iMTAiIHdpZHRoPSIxMCIgaGVpZ2h0PSIxMCIgLz4KICAgICAgICA8L3BhdHRlcm4+CiAgICA8L2RlZnM+CiAgICA8cmVjdCBmaWxsPSJ1cmwoI2dyaWQpIiB4PSIwIiB5PSIwIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiAvPgo8L3N2Zz4=');
2019-12-24 14:30:31 +08:00
overflow: hidden;
position: relative;
> img {
position: absolute;
left: 50%;
top: 50%;
height: 100%;
width: auto;
transform: translate(-50%, -50%);
}
}
2019-12-24 17:30:11 +08:00
&-thumb--4-3 {
height: px2rem(108px * 3 / 4);
}
&-thumb--16-9 {
height: px2rem(108px * 9 / 16);
}
2019-12-24 14:30:31 +08:00
&-thumb--w-full > img {
width: 100%;
height: auto;
}
@supports (object-fit: contain) {
&-thumb--contain > img {
position: static;
2019-12-24 20:11:26 +08:00
width: 100% !important;
height: 100% !important;
2019-12-24 14:30:31 +08:00
transform: translate(0, 0);
top: 0;
left: 0;
object-fit: contain;
}
}
@supports (object-fit: cover) {
&-thumb--cover > img {
position: static;
2019-12-24 20:11:26 +08:00
width: 100% !important;
height: 100% !important;
2019-12-24 14:30:31 +08:00
transform: translate(0, 0);
top: 0;
left: 0;
object-fit: cover;
}
}
2020-01-06 19:32:12 +08:00
&-caption {
font-size: $fontSizeSm;
}
2020-01-06 22:54:24 +08:00
&-overlay {
background: rgba(0, 0, 0, 0.6);
position: absolute;
width: 100%;
height: 100%;
display: none;
top: 0;
left: 0;
justify-content: center;
align-items: center;
align-content: center;
flex-wrap: wrap;
color: #fff;
> div {
width: 100%;
text-align: center;
margin-bottom: 5px;
}
> a {
cursor: pointer;
color: #fff;
display: inline-block;
padding: 0 5px;
line-height: 1;
font-size: px2rem(16px);
}
}
&-thumb:hover &-overlay {
display: flex;
}
2019-12-24 14:30:31 +08:00
}
.#{$ns}ImageField {
display: inline-block;
position: relative;
}