Update image component

This commit is contained in:
DefectingCat
2022-08-18 17:03:15 +08:00
parent 3ad3d96f67
commit 177fae5948
4 changed files with 28 additions and 24 deletions

View File

@ -1,3 +1,4 @@
import classNames from 'classnames';
import NextImage, { ImageProps } from 'next/future/image';
interface Props extends ImageProps {}
@ -5,10 +6,18 @@ interface Props extends ImageProps {}
const Image = ({ alt, ...rest }: Props) => {
return (
<>
<span className="block text-center">
<NextImage alt={alt} {...rest} />
{alt && <span className="block text-center text-gray-400">{alt}</span>}
</span>
<NextImage className="mx-auto" alt={alt} {...rest} />
{alt && (
<span
className={classNames(
'block mx-auto',
'text-center text-gray-400',
'mt-2'
)}
>
{alt}
</span>
)}
</>
);
};

View File

@ -1,11 +1,15 @@
import RUASandpack from 'components/RUA/RUASandpack';
import Anchor from 'components/mdx/Anchor';
import Image from 'components/mdx/Image';
import Tab from 'components/RUA/tab';
import TabItem from 'components/RUA/tab/TabItem';
const components = {
RUASandpack,
a: Anchor,
Image,
Tab,
TabItem,
};
export default components;