Skip to content

Commit a636625

Browse files
[getsentry/action-github-commit] Auto commit
1 parent 12ca95c commit a636625

File tree

3 files changed

+36
-11
lines changed

3 files changed

+36
-11
lines changed

src/components/docImage.tsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,22 @@ export default function DocImage({
4040
.slice(1)
4141
.split('x')
4242
.map(s => parseInt(s, 10));
43-
43+
4444
// Use parsed dimensions, fallback to props, then default to 800
45-
const width = !isNaN(dimensions[0]) ? dimensions[0] :
46-
(typeof propsWidth === 'number' ? propsWidth :
47-
typeof propsWidth === 'string' ? parseInt(propsWidth, 10) || 800 : 800);
48-
const height = !isNaN(dimensions[1]) ? dimensions[1] :
49-
(typeof propsHeight === 'number' ? propsHeight :
50-
typeof propsHeight === 'string' ? parseInt(propsHeight, 10) || 800 : 800);
45+
const width = !isNaN(dimensions[0])
46+
? dimensions[0]
47+
: typeof propsWidth === 'number'
48+
? propsWidth
49+
: typeof propsWidth === 'string'
50+
? parseInt(propsWidth, 10) || 800
51+
: 800;
52+
const height = !isNaN(dimensions[1])
53+
? dimensions[1]
54+
: typeof propsHeight === 'number'
55+
? propsHeight
56+
: typeof propsHeight === 'string'
57+
? parseInt(propsHeight, 10) || 800
58+
: 800;
5159

5260
return (
5361
<DocImageClient

src/components/docImageClient.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ import Image from 'next/image';
44

55
import {ImageLightbox} from './imageLightbox';
66

7-
interface DocImageClientProps extends Omit<React.HTMLProps<HTMLImageElement>, 'ref' | 'placeholder' | 'src' | 'width' | 'height'> {
7+
interface DocImageClientProps
8+
extends Omit<
9+
React.HTMLProps<HTMLImageElement>,
10+
'ref' | 'placeholder' | 'src' | 'width' | 'height'
11+
> {
812
height: number;
913
imgPath: string;
1014
src: string;
@@ -23,7 +27,7 @@ export function DocImageClient({
2327
}: DocImageClientProps) {
2428
// Check if dimensions are valid (not NaN) for Next.js Image
2529
const isValidDimensions = !isNaN(width) && !isNaN(height) && width > 0 && height > 0;
26-
30+
2731
// For external images or invalid dimensions, fall back to regular img tag
2832
if (src.startsWith('http') || !isValidDimensions) {
2933
return (
@@ -45,7 +49,13 @@ export function DocImageClient({
4549
}
4650

4751
return (
48-
<ImageLightbox src={src} alt={alt ?? ''} width={width} height={height} imgPath={imgPath}>
52+
<ImageLightbox
53+
src={src}
54+
alt={alt ?? ''}
55+
width={width}
56+
height={height}
57+
imgPath={imgPath}
58+
>
4959
<Image
5060
src={src}
5161
width={width}

src/components/imageLightbox.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,14 @@ interface ImageLightboxProps {
1414
width: number;
1515
}
1616

17-
export function ImageLightbox({src, alt, width, height, imgPath, children}: ImageLightboxProps) {
17+
export function ImageLightbox({
18+
src,
19+
alt,
20+
width,
21+
height,
22+
imgPath,
23+
children,
24+
}: ImageLightboxProps) {
1825
const [open, setOpen] = useState(false);
1926

2027
const handleClick = (e: React.MouseEvent) => {

0 commit comments

Comments
 (0)