mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 03:59:01 +08:00
18c6d6fedb
* feat: Image add PreviewGroup component to support multiple images preview * demo and PreviewGroup type * add demo snapshot
22 lines
645 B
TypeScript
22 lines
645 B
TypeScript
import * as React from 'react';
|
|
import RcImage, { ImageProps } from 'rc-image';
|
|
import PreviewGroup from './PreviewGroup';
|
|
import { ConfigContext } from '../config-provider';
|
|
|
|
export interface CompositionImage<P> extends React.FC<P> {
|
|
PreviewGroup: typeof PreviewGroup;
|
|
}
|
|
|
|
const Image: CompositionImage<ImageProps> = ({ prefixCls: customizePrefixCls, ...otherProps }) => {
|
|
const { getPrefixCls } = React.useContext(ConfigContext);
|
|
const prefixCls = getPrefixCls('image', customizePrefixCls);
|
|
|
|
return <RcImage prefixCls={prefixCls} {...otherProps} />;
|
|
};
|
|
|
|
export { ImageProps };
|
|
|
|
Image.PreviewGroup = PreviewGroup;
|
|
|
|
export default Image;
|