Skip to content

Commit

Permalink
fix: add inline style on img to counteract height auto in local previ…
Browse files Browse the repository at this point in the history
…ew (#1968)
  • Loading branch information
abvthecity authored Jan 8, 2025
1 parent 47d0770 commit d573935
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/fern-docs/ui/src/components/FernImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ export const FernImage = forwardRef<
alt={props.alt}
fetchPriority={props.priority ? "high" : undefined}
loading={props.priority ? "eager" : undefined}
// on local dev, the preflight css for <img> tags is `max-width: 100%; height: auto;`
// which causes the image height to be ignored. we'll use the inline style prop to override this behavior:
style={{
width,
height,
...props.style,
}}
/>
);
}
Expand All @@ -69,6 +76,13 @@ export const FernImage = forwardRef<
pathname?.endsWith(".svg") ||
props.unoptimized
}
// on local dev, the preflight css for <img> tags is `max-width: 100%; height: auto;`
// which causes the image height to be ignored. we'll use the inline style prop to override this behavior:
style={{
width,
height,
...props.style,
}}
/>
);
});
Expand Down

0 comments on commit d573935

Please sign in to comment.