forked from ant-design/ant-design
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(📦): upgrade rc-image to 5.x (ant-design#28727)
* refactor: upgrade rc-image to 5.x reduce bundle size * upgrade rc-image * upgrade @ant-design/tools ant-design/antd-tools#226 * rc-image 5.0.0 * fix image preview icon missing * refactor code
- Loading branch information
Showing
3 changed files
with
29 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,38 @@ | ||
import * as React from 'react'; | ||
import RcImage from 'rc-image'; | ||
import { GroupConsumerProps } from 'rc-image/lib/PreviewGroup'; | ||
import RotateLeftOutlined from '@ant-design/icons/RotateLeftOutlined'; | ||
import RotateRightOutlined from '@ant-design/icons/RotateRightOutlined'; | ||
import ZoomInOutlined from '@ant-design/icons/ZoomInOutlined'; | ||
import ZoomOutOutlined from '@ant-design/icons/ZoomOutOutlined'; | ||
import CloseOutlined from '@ant-design/icons/CloseOutlined'; | ||
import LeftOutlined from '@ant-design/icons/LeftOutlined'; | ||
import RightOutlined from '@ant-design/icons/RightOutlined'; | ||
import type { GroupConsumerProps } from 'rc-image/lib/PreviewGroup'; | ||
import { ConfigContext } from '../config-provider'; | ||
|
||
export const icons = { | ||
rotateLeft: <RotateLeftOutlined />, | ||
rotateRight: <RotateRightOutlined />, | ||
zoomIn: <ZoomInOutlined />, | ||
zoomOut: <ZoomOutOutlined />, | ||
close: <CloseOutlined />, | ||
left: <LeftOutlined />, | ||
right: <RightOutlined />, | ||
}; | ||
|
||
const InternalPreviewGroup: React.FC<GroupConsumerProps> = ({ | ||
previewPrefixCls: customizePrefixCls, | ||
...props | ||
}) => { | ||
const { getPrefixCls } = React.useContext(ConfigContext); | ||
const prefixCls = getPrefixCls('image-preview', customizePrefixCls); | ||
return <RcImage.PreviewGroup previewPrefixCls={prefixCls} {...props} />; | ||
return ( | ||
<RcImage.PreviewGroup | ||
previewPrefixCls={prefixCls} | ||
icons={icons} | ||
{...props} | ||
/> | ||
); | ||
}; | ||
|
||
export default InternalPreviewGroup; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters