neater way to do hover thing with still image

feat/video-poster
Henry Jameson 4 years ago
parent 65b6e23c00
commit 7870b3f7ec

@ -10,16 +10,9 @@ $status-margin: 0.75em;
border-left: 4px $fallback--cRed; border-left: 4px $fallback--cRed;
border-left: 4px var(--cRed, $fallback--cRed); border-left: 4px var(--cRed, $fallback--cRed);
// TODO find a way to do this in a cleaner way without JS &:hover .avatar {
// stylelint-disable rscss/class-format --still-image-img: visible;
&:hover .avatar.animated { --still-image-canvas: hidden;
canvas {
display: none;
}
img {
visibility: visible;
}
} }
&.-focused { &.-focused {

@ -35,8 +35,16 @@
display: flex; display: flex;
align-items: center; align-items: center;
&:hover canvas { canvas {
display: none; position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
width: 100%;
height: 100%;
object-fit: contain;
visibility: var(--still-image-canvas, visible);
} }
img { img {
@ -46,15 +54,6 @@
} }
&.animated { &.animated {
&:hover::before,
img {
visibility: hidden;
}
&:hover img {
visibility: visible
}
&::before { &::before {
content: 'gif'; content: 'gif';
position: absolute; position: absolute;
@ -62,25 +61,27 @@
font-size: 10px; font-size: 10px;
top: 5px; top: 5px;
left: 5px; left: 5px;
background: rgba(127,127,127,.5); background: rgba(127, 127, 127, 0.5);
color: #FFF; color: #fff;
display: block; display: block;
padding: 2px 4px; padding: 2px 4px;
border-radius: $fallback--tooltipRadius; border-radius: $fallback--tooltipRadius;
border-radius: var(--tooltipRadius, $fallback--tooltipRadius); border-radius: var(--tooltipRadius, $fallback--tooltipRadius);
z-index: 2; z-index: 2;
} }
}
canvas { &:hover canvas {
position: absolute; display: none;
top: 0; }
bottom: 0;
left: 0; &:hover::before,
right: 0; img {
width: 100%; visibility: var(--still-image-img, hidden);
height: 100%; }
object-fit: contain;
&:hover img {
visibility: visible;
}
} }
} }
</style> </style>

Loading…
Cancel
Save