Skip to content

Commit f222c55

Browse files
authored
Merge pull request #19038 from newrelic/clark/86-lightbox
fix: Update MDX handler to no longer use Lightbox
2 parents 9e49790 + 29de591 commit f222c55

File tree

4 files changed

+44
-32
lines changed

4 files changed

+44
-32
lines changed

gatsby-config.js

Lines changed: 1 addition & 1 deletion
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
},

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"@emotion/styled": "^11.3.0",
1111
"@mdx-js/mdx": "2.0.0-next.8",
1212
"@mdx-js/react": "2.0.0-next.8",
13-
"@newrelic/gatsby-theme-newrelic": "9.10.3",
13+
"@newrelic/gatsby-theme-newrelic": "9.10.4",
1414
"@splitsoftware/splitio-react": "^1.2.4",
1515
"ansi-colors": "^4.1.3",
1616
"cockatiel": "^3.0.0-beta.0",
@@ -237,4 +237,4 @@
237237
"bugs": {
238238
"url": "https://github.com/newrelic/docs-website/issues"
239239
}
240-
}
240+
}

src/components/MDXContainer.js

Lines changed: 37 additions & 25 deletions
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

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3616,10 +3616,10 @@
36163616
eslint-plugin-promise "^4.2.1"
36173617
eslint-plugin-react "^7.14.3"
36183618

3619-
"@newrelic/[email protected].3":
3620-
version "9.10.3"
3621-
resolved "https://registry.yarnpkg.com/@newrelic/gatsby-theme-newrelic/-/gatsby-theme-newrelic-9.10.3.tgz#bfd66da5dd0e2ff7b0a2a2bf20875bf81de5009a"
3622-
integrity sha512-2XeVjjIb9HOJCLWB2ujaXjr1H2BuAelPBtcebrI2cgehQpJUrdrA6yPXZvzxVWpLSfXIF6bO61sRnmD/Ldw9fg==
3619+
"@newrelic/[email protected].4":
3620+
version "9.10.4"
3621+
resolved "https://registry.yarnpkg.com/@newrelic/gatsby-theme-newrelic/-/gatsby-theme-newrelic-9.10.4.tgz#98862253d31465c0a51806288f7da98415d35c57"
3622+
integrity sha512-/WVfjez7/C/0H1tb4r8IQluqiGT6kFOpLUV9DaN51PxJopM9pclpQdCwmEZ8LF0+wX8ed4TX+ZrnsoDq5F1GYg==
36233623
dependencies:
36243624
"@segment/analytics-next" "1.63.0"
36253625
"@wry/equality" "^0.4.0"

0 commit comments

Comments
 (0)