Skip to content

Commit

Permalink
fix: set image view max-w
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Feb 2, 2024
1 parent c7c1fc0 commit 32f076c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/components/ui/editor/Milkdown/plugins/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ const Image = () => {
return (
<div className="my-4 flex center">
<div className="group relative inline-block">
<FixedZoomedImage src={src} containerWidth={isMobile ? 450 : 600} />
<FixedZoomedImage
className="max-h-[80vh]"
src={src}
containerWidth={isMobile ? 450 : 600}
/>

<div className="absolute bottom-1 left-1 z-[10] opacity-0 duration-200 group-hover:opacity-100">
<StyledButton
Expand Down
4 changes: 3 additions & 1 deletion src/components/ui/image/ZoomedImage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client'

import { forwardRef, useCallback, useMemo, useRef, useState } from 'react'
import clsx from 'clsx'
import { useIsomorphicLayoutEffect } from 'foxact/use-isomorphic-layout-effect'
import mediumZoom from 'medium-zoom'
import Image from 'next/image'
Expand Down Expand Up @@ -61,6 +62,7 @@ export const ImageLazy: Component<TImageProps & BaseImageProps> = ({
placeholder,
height,
width,
className,
}) => {
const [zoomer_] = useState(() => {
if (isServerSide) return null!
Expand Down Expand Up @@ -134,7 +136,7 @@ export const ImageLazy: Component<TImageProps & BaseImageProps> = ({
onError={() => setImageLoadStatusSafe(ImageLoadStatus.Error)}
className={styles({
status: imageLoadStatus,
className: imageStyles[ImageLoadStatus.Loaded],
className: clsx(imageStyles[ImageLoadStatus.Loaded], className),
})}
onAnimationEnd={(e: Event) => {
if (ImageLoadStatus.Loaded) {
Expand Down

0 comments on commit 32f076c

Please sign in to comment.