Files
DefectingCat.github.io/components/mdx/image.tsx
DefectingCat f8a5ccd453 update format
2023-05-16 17:12:18 +08:00

22 lines
476 B
TypeScript

import clsx from 'clsx';
import NextImage, { ImageProps } from 'next/image';
import { memo } from 'react';
interface Props extends ImageProps {}
const Image = ({ alt, ...rest }: Props) => {
return (
<>
<NextImage className="mx-auto" alt={alt} {...rest} />
{alt && (
<span
className={clsx('block mx-auto', 'text-center text-gray-400', 'my-2')}
>
{alt}
</span>
)}
</>
);
};
export default memo(Image);