Skip to content

Commit 7420d8d

Browse files
committed
fix: Update MDX handler to no longer use Lightbox
1 parent 3930b34 commit 7420d8d

File tree

2 files changed

+38
-26
lines changed

2 files changed

+38
-26
lines changed

gatsby-config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ module.exports = {
131131
resolve: 'gatsby-remark-images',
132132
options: {
133133
maxWidth: 850,
134-
linkImagesToOriginal: false,
134+
linkImagesToOriginal: true,
135135
backgroundColor: 'transparent',
136136
disableBgImageOnAlpha: true,
137137
},

src/components/MDXContainer.js

+37-25
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {
22
ExternalLink,
33
Link,
4-
Lightbox,
54
MDXLink,
65
MDX,
76
MarkdownContainer,
@@ -53,30 +52,43 @@ const defaultComponents = {
5352
}
5453
/>
5554
) : (
56-
<Lightbox>
57-
<img
58-
width={props.width ? props.width : 'auto'}
59-
src={props.src}
60-
// this prevents images from stretching if the width is set to a percent value
61-
className={cx(props.className, props.width && 'unbound')}
62-
alt={props.alt ? props.alt : 'Docs site'}
63-
title={props.title}
64-
style={
65-
props.style
66-
? {
67-
...props.style,
68-
borderRadius: '0.25rem',
69-
maxWidth: '100%',
70-
margin: '0 0.25rem',
71-
}
72-
: {
73-
borderRadius: '0.25rem',
74-
maxWidth: '100%',
75-
margin: '0 0.25rem',
76-
}
77-
}
78-
/>
79-
</Lightbox>
55+
<span
56+
style={{
57+
position: 'relative',
58+
display: 'block',
59+
textAlign: 'center',
60+
margin: '1em 0',
61+
}}
62+
>
63+
<a
64+
href={props.src}
65+
target="_blank"
66+
rel="noreferrer"
67+
style={{ display: 'inline-block' }}
68+
>
69+
<img
70+
width={props.width ? props.width : 'auto'}
71+
src={props.src}
72+
alt={props.alt ? props.alt : 'Docs site'}
73+
title={props.title}
74+
style={
75+
props.style
76+
? {
77+
...props.style,
78+
borderRadius: '0.25rem',
79+
maxWidth: '100%',
80+
margin: '0 0.25rem',
81+
}
82+
: {
83+
borderRadius: '0.25rem',
84+
maxWidth: '100%',
85+
margin: '0 0.25rem',
86+
}
87+
}
88+
loading="lazy"
89+
/>
90+
</a>
91+
</span>
8092
),
8193
DocTile: (props) => (
8294
<DocTile

0 commit comments

Comments
 (0)