Skip to content

Commit

Permalink
chore: memo image
Browse files Browse the repository at this point in the history
  • Loading branch information
ImLunaHey committed Jan 9, 2025
1 parent cc669c6 commit 36f9507
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/ui/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useSettings } from '@/hooks/useSetting';
import { cn } from '@/lib/utils';
import { Dialog, DialogContent, DialogTitle, DialogTrigger } from './dialog';
import { VisuallyHidden } from '@ariakit/react';
import { memo } from 'react';

type ImageProps = Omit<React.ImgHTMLAttributes<HTMLImageElement>, 'className'> & {
classNames?: {
Expand All @@ -12,7 +13,7 @@ type ImageProps = Omit<React.ImgHTMLAttributes<HTMLImageElement>, 'className'> &
clickable?: boolean;
};

export const Image = ({ src, alt, classNames, clickable = true, ...props }: ImageProps) => {
const ImageInner = ({ src, alt, classNames, clickable = true, ...props }: ImageProps) => {
const { experiments } = useSettings();
const { t } = useTranslation('image');

Expand Down Expand Up @@ -64,3 +65,5 @@ export const Image = ({ src, alt, classNames, clickable = true, ...props }: Imag
</div>
);
};

export const Image = memo(ImageInner);

0 comments on commit 36f9507

Please sign in to comment.