Skip to content

Commit

Permalink
💄 style: Remove image hover in mobile mode
Browse files Browse the repository at this point in the history
  • Loading branch information
canisminor1990 committed Dec 2, 2023
1 parent e23c854 commit 3167fb5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/Image/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Image as AntImage, type ImageProps as AntImageProps, Skeleton } from 'antd';
import { useResponsive } from 'antd-style';
import { Eye } from 'lucide-react';
import { ReactNode, memo } from 'react';
import { Flexbox } from 'react-layout-kit';
Expand Down Expand Up @@ -30,6 +31,7 @@ const Image = memo<ImageProps>(
objectFit = 'cover',
...rest
}) => {
const { mobile } = useResponsive();
const { styles, cx, theme } = useStyles({ alwaysShowActions, minSize, objectFit, size });
const mergePreivew = usePreview(preview);

Expand All @@ -54,7 +56,7 @@ const Image = memo<ImageProps>(
fallback={styles.imageOff}
loading={'lazy'}
preview={{
mask: actions ? <div /> : <Icon icon={Eye} size={'normal'} />,
mask: mobile ? false : actions ? <div /> : <Icon icon={Eye} size={'normal'} />,
...(mergePreivew as any),
}}
wrapperClassName={styles.image}
Expand Down
15 changes: 12 additions & 3 deletions src/Markdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,34 @@ export interface MarkdownProps {
* @description The class name for the Markdown component
*/
className?: string;
enableImageGallery?: boolean;
fullFeaturedCodeBlock?: boolean;
onDoubleClick?: () => void;
style?: CSSProperties;
}

const Markdown = memo<MarkdownProps>(
({ children, className, style, fullFeaturedCodeBlock, onDoubleClick, ...rest }) => {
({
children,
className,
style,
fullFeaturedCodeBlock,
onDoubleClick,
enableImageGallery = true,
...rest
}) => {
const { styles } = useStyles();
const components: Components = {
a: (props: any) => <Typography.Link {...props} rel="noopener noreferrer" target="_blank" />,
details: (props: any) => <Collapse {...props} />,
hr: () => <Divider style={{ marginBottom: '1em', marginTop: 0 }} />,
img: (props: any) => <Image {...props} />,
img: enableImageGallery ? (props: any) => <Image {...props} /> : undefined,
pre: fullFeaturedCodeBlock ? CodeFullFeatured : CodeLite,
};

return (
<Typography className={className} onDoubleClick={onDoubleClick} style={style}>
<ImageGallery>
<ImageGallery enable={enableImageGallery}>
<ErrorBoundary
fallback={
<ReactMarkdown
Expand Down

0 comments on commit 3167fb5

Please sign in to comment.