Skip to content

Commit

Permalink
fix: image type error
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Dec 10, 2023
1 parent 0c2a21d commit 07bee74
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 22 deletions.
1 change: 0 additions & 1 deletion .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ steps:
commands:
- 'npm i -g pnpm'
- 'pnpm install --no-frozen-lockfile'
- 'nslookup fonts.gstatic.com'
- 'npm run build'

depends_on:
Expand Down
38 changes: 17 additions & 21 deletions src/components/ui/image/ZoomedImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export const ImageLazy: Component<TImageProps & BaseImageProps> = ({
status: imageLoadStatus,
className: imageStyles[ImageLoadStatus.Loaded],
})}
onAnimationEnd={(e) => {
onAnimationEnd={(e: Event) => {
if (ImageLoadStatus.Loaded) {
;(e.target as HTMLElement).classList.remove(
imageStyles[ImageLoadStatus.Loaded],
Expand Down Expand Up @@ -262,25 +262,21 @@ const NoFixedPlaceholder = ({ accent }: { accent?: string }) => {
)
}

// @ts-expect-error
const OptimizedImage: FC<React.JSX.IntrinsicElements['img']> = forwardRef(
({ src, alt, placeholder, ...rest }, ref) => {
const { height, width } = useMarkdownImageRecord(src!) || rest
if (!height || !width)
return <img alt={alt} src={src} ref={ref} {...rest} />
return (
<Image
alt={alt || ''}
fetchPriority="high"
priority
src={src!}
{...rest}
height={+height}
width={+width}
ref={ref as any}
/>
)
},
)
const OptimizedImage: FC<any> = forwardRef(({ src, alt, ...rest }, ref) => {
const { height, width } = useMarkdownImageRecord(src!) || rest
if (!height || !width) return <img alt={alt} src={src} ref={ref} {...rest} />
return (
<Image
alt={alt || ''}
fetchPriority="high"
priority
src={src!}
{...rest}
height={+height}
width={+width}
ref={ref as any}
/>
)
})

OptimizedImage.displayName = 'OptimizedImage'

0 comments on commit 07bee74

Please sign in to comment.