1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-24 20:36:40 +07:00

fixed image width calculation

This commit is contained in:
Fedor Katurov 2021-06-25 17:09:03 +07:00
parent 02bc12f727
commit 7ce8939dce
2 changed files with 25 additions and 22 deletions

View file

@ -47,43 +47,37 @@ const ImagePreloader: FC<IProps> = ({ file, onLoad, onClick, className }) => {
useResizeHandler(onResize);
const estimatedWidth = (width * maxHeight) / height;
return (
<>
<svg
viewBox={`0 0 ${width} ${height}`}
className={classNames(styles.preview, { [styles.is_loaded]: loaded })}
style={{
maxHeight,
height: height,
maxHeight: maxHeight,
width: estimatedWidth,
}}
onClick={onClick}
>
<defs>
<filter id="f1" x="0" y="0">
<feGaussianBlur
stdDeviation="30 30"
x="0%"
y="0%"
width="100%"
height="100%"
in="blend"
edgeMode="none"
result="blur2"
/>
<feGaussianBlur in="SourceGraphic" stdDeviation="30" />
</filter>
</defs>
<rect fill="#242222" width="100%" height="100%" stroke="none" rx="8" ry="8" />
<g filter="url(#f1)">
<rect fill="#222222" width="100%" height="100%" stroke="none" rx="8" ry="8" />
{!hasError && (
<image
xlinkHref={getURL(file, PRESETS['300'])}
width="100%"
height="100%"
filter="url(#f1)"
onLoad={onLoad}
/>
)}
{!hasError && (
<image
xlinkHref={getURL(file, PRESETS['300'])}
width="100%"
height="100%"
onLoad={onLoad}
/>
)}
</g>
</svg>
<img

View file

@ -24,8 +24,17 @@
bottom: 40px;
opacity: 0.4;
@include tablet {
right: 5px;
bottom: 5px;
}
svg {
fill: currentColor;
@include tablet {
transform: scale(0.6);
}
}
}