Skip to content

Commit 0f1d35c

Browse files
committed
Split up ternaries
1 parent 4789ed3 commit 0f1d35c

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/components/docImage/index.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,12 @@ export default function DocImage({
107107
// If either width or height is specified manually, ignore any hash dimensions entirely
108108
const isManual = manualWidth != null || manualHeight != null;
109109
const hashDimensions = isManual ? [] : parseDimensionsFromHash(src);
110-
const width = isManual
111-
? manualWidth
112-
: hashDimensions[0] > 0
113-
? hashDimensions[0]
114-
: undefined;
115-
const height = isManual
116-
? manualHeight
117-
: hashDimensions[1] > 0
118-
? hashDimensions[1]
119-
: undefined;
110+
111+
const inferredWidth = hashDimensions[0] > 0 ? hashDimensions[0] : undefined;
112+
const width = isManual ? manualWidth : inferredWidth;
113+
114+
const inferredHeight = hashDimensions[1] > 0 ? hashDimensions[1] : undefined;
115+
const height = isManual ? manualHeight : inferredHeight;
120116

121117
return (
122118
<ImageLightbox

0 commit comments

Comments
 (0)