2020-08-22 22:02:20 +08:00
|
|
|
import * as React from 'react';
|
|
|
|
import RcImage, { ImageProps } from 'rc-image';
|
2020-11-30 15:54:54 +08:00
|
|
|
import PreviewGroup from './PreviewGroup';
|
2020-10-12 10:59:09 +08:00
|
|
|
import { ConfigContext } from '../config-provider';
|
2020-08-22 22:02:20 +08:00
|
|
|
|
2020-11-30 15:54:54 +08:00
|
|
|
export interface CompositionImage<P> extends React.FC<P> {
|
|
|
|
PreviewGroup: typeof PreviewGroup;
|
|
|
|
}
|
|
|
|
|
|
|
|
const Image: CompositionImage<ImageProps> = ({ prefixCls: customizePrefixCls, ...otherProps }) => {
|
2020-10-12 10:59:09 +08:00
|
|
|
const { getPrefixCls } = React.useContext(ConfigContext);
|
2020-08-22 22:02:20 +08:00
|
|
|
const prefixCls = getPrefixCls('image', customizePrefixCls);
|
|
|
|
|
|
|
|
return <RcImage prefixCls={prefixCls} {...otherProps} />;
|
|
|
|
};
|
|
|
|
|
2020-11-18 13:48:30 +08:00
|
|
|
export { ImageProps };
|
|
|
|
|
2020-11-30 15:54:54 +08:00
|
|
|
Image.PreviewGroup = PreviewGroup;
|
|
|
|
|
2020-08-22 22:02:20 +08:00
|
|
|
export default Image;
|