Skip to content

Commit 664be7e

Browse files
Add border to doc images, fix aspect ratio. (#992)
1 parent 5d3f519 commit 664be7e

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/common/imageUrlBuilder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ export const imageUrlBuilder = unconfiguredImageUrlBuilder()
1616
.dpr(window.devicePixelRatio ?? 1)
1717
.quality(defaultQuality);
1818

19-
export const getAspectRatio = (imageRef: string): number | undefined => {
19+
export const getAspectRatio = (imageRef: string): string | undefined => {
2020
const dimensionsArr = imageRef.match(/\d+x\d+/g);
2121
if (!dimensionsArr) {
2222
return undefined;
2323
}
2424
const dimensions = dimensionsArr.join().split("x");
2525
const [width, height] = dimensions.map((n: string) => Number(n));
26-
return width / height;
26+
return (width / height).toString();
2727
};

src/documentation/common/DocumentationContent.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,12 @@ const serializers = {
211211
.url()}
212212
alt={props.node.alt}
213213
width={300}
214-
sx={{ aspectRatio: getAspectRatio(props.node.asset._ref) }}
214+
borderRadius="lg"
215+
border="solid 1px"
216+
borderColor="gray.300"
217+
sx={{
218+
aspectRatio: getAspectRatio(props.node.asset._ref),
219+
}}
215220
/>
216221
);
217222
},

0 commit comments

Comments
 (0)