Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
leizzboy and mergify[bot] authored Aug 3, 2022
1 parent eed32f6 commit 5e23c20
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const config = {
if(locale !== 'en') {
return `https://github.com/stoneatom/stonedb/edit/stonedb-5.7/website/i18n/${locale}/docusaurus-plugin-content-docs/current/${docPath}`
}
return `https://github.com/stoneatom/stonedb/edit/stonedb-5.7/${versionDocsDirPath}/${docPath}`
return `https://github.com/stoneatom/stonedb/edit/stonedb-5.7/Docs/${docPath}`
},
},
theme: {
Expand Down
28 changes: 22 additions & 6 deletions website/src/theme/MDXComponents/Image.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
import React from 'react';
import {pipe, split, map, fromPairs, trim, isEmpty} from 'ramda';
import {pipe, split, map, fromPairs, trim, isEmpty, is} from 'ramda';
import {Image, OmitText} from '@site/src/components';
import {modifyKeyName} from '@site/src/utils';

export default function MDXImage({className, alt, src, title, ...props}: any): JSX.Element {
const data = title && title.indexOf(':') >= 0 ? pipe(
const isCustomImg = title && title.indexOf(':') >= 0;
const data = isCustomImg ? pipe(
split(','),
map(split(':')),
fromPairs,
modifyKeyName(trim)
)(title) : title ? {title} : {};
return (
<Image src={src} className={className} alt={alt} to={data.to}>
<OmitText size={20}>{data.title}</OmitText>
</Image>
<>
{
isCustomImg ? (
<Image src={src} className={className} alt={alt} to={data.to}>
<OmitText size={20}>{data.title}</OmitText>
</Image>
) : (
<img
loading="lazy"
alt={alt}
src={src}
title={title}
{...props}
className={props.className}
/>
)
}
</>
)
}
}

0 comments on commit 5e23c20

Please sign in to comment.