index.tsx 527 B

1234567891011121314151617181920212223
  1. import React from 'react';
  2. import { Empty } from '@douyinfe/semi-ui';
  3. import './index.scss';
  4. interface ImageBoxProps {
  5. url: string;
  6. darkUrl?: string;
  7. alt: string
  8. }
  9. function ImageBox(props: ImageBoxProps): React.ReactElement {
  10. const { url, alt, darkUrl } = props;
  11. return (
  12. <Empty
  13. className='imagebox'
  14. image={<img alt={alt} src={url} />}
  15. darkModeImage={darkUrl ? <img alt={alt} src={darkUrl} /> : null }
  16. />
  17. );
  18. }
  19. export default React.memo(ImageBox);