Skip to content

Commit

Permalink
fix: Update MDX handler to no longer use Lightbox
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkmcadoo committed Oct 22, 2024
1 parent 3930b34 commit 7420d8d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 26 deletions.
2 changes: 1 addition & 1 deletion gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ module.exports = {
resolve: 'gatsby-remark-images',
options: {
maxWidth: 850,
linkImagesToOriginal: false,
linkImagesToOriginal: true,
backgroundColor: 'transparent',
disableBgImageOnAlpha: true,
},
Expand Down
62 changes: 37 additions & 25 deletions src/components/MDXContainer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
ExternalLink,
Link,
Lightbox,
MDXLink,
MDX,
MarkdownContainer,
Expand Down Expand Up @@ -53,30 +52,43 @@ const defaultComponents = {
}
/>
) : (
<Lightbox>
<img
width={props.width ? props.width : 'auto'}
src={props.src}
// this prevents images from stretching if the width is set to a percent value
className={cx(props.className, props.width && 'unbound')}
alt={props.alt ? props.alt : 'Docs site'}
title={props.title}
style={
props.style
? {
...props.style,
borderRadius: '0.25rem',
maxWidth: '100%',
margin: '0 0.25rem',
}
: {
borderRadius: '0.25rem',
maxWidth: '100%',
margin: '0 0.25rem',
}
}
/>
</Lightbox>
<span
style={{
position: 'relative',
display: 'block',
textAlign: 'center',
margin: '1em 0',
}}
>
<a
href={props.src}
target="_blank"
rel="noreferrer"
style={{ display: 'inline-block' }}
>
<img
width={props.width ? props.width : 'auto'}
src={props.src}
alt={props.alt ? props.alt : 'Docs site'}
title={props.title}
style={
props.style
? {
...props.style,
borderRadius: '0.25rem',
maxWidth: '100%',
margin: '0 0.25rem',
}
: {
borderRadius: '0.25rem',
maxWidth: '100%',
margin: '0 0.25rem',
}
}
loading="lazy"
/>
</a>
</span>
),
DocTile: (props) => (
<DocTile
Expand Down

0 comments on commit 7420d8d

Please sign in to comment.