Skip to content

Commit 4a04fd9

Browse files
committed
Use aspect ratio fallback for images aswell
1 parent ddceb4b commit 4a04fd9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/components/asset.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ const Asset: React.FC<{ block: BlockType }> = ({ block }) => {
1919
block_width
2020
} = format;
2121

22+
const aspectRatio = block_aspect_ratio || block_height / block_width;
23+
2224
if (type === "embed" || type === "video") {
2325
return (
2426
<div
2527
style={{
26-
paddingBottom: `${(block_aspect_ratio || block_height / block_width) *
27-
100}%`,
28+
paddingBottom: `${aspectRatio * 100}%`,
2829
position: "relative"
2930
}}
3031
>
@@ -43,7 +44,7 @@ const Asset: React.FC<{ block: BlockType }> = ({ block }) => {
4344
return (
4445
<div
4546
style={{
46-
paddingBottom: `${block_aspect_ratio * 100}%`,
47+
paddingBottom: `${aspectRatio * 100}%`,
4748
position: "relative"
4849
}}
4950
>

0 commit comments

Comments
 (0)