From 2fe979bf19bb7d412e82a09b80da42486783564d Mon Sep 17 00:00:00 2001 From: kiner-tang <1127031143@qq.com> Date: Tue, 28 Nov 2023 17:18:31 +0800 Subject: [PATCH] feat: operation default icons (#297) * feat: operation default icons * feat: operation default icons * feat: operation default icons * feat: operation default icons * feat: operation default icons --- docs/examples/album.tsx | 2 ++ docs/examples/basic.tsx | 29 ++++++--------------------- docs/examples/common.tsx | 25 +++++++++++++++++++++++ docs/examples/controlled.tsx | 2 ++ docs/examples/controlledWithGroup.tsx | 2 ++ docs/examples/fallback.tsx | 3 ++- docs/examples/imageRender.tsx | 2 ++ docs/examples/placeholder.tsx | 3 +++ docs/examples/thumbnail.tsx | 4 +++- docs/examples/toolbarRender.tsx | 2 ++ src/PreviewGroup.tsx | 4 ++-- 11 files changed, 51 insertions(+), 27 deletions(-) create mode 100644 docs/examples/common.tsx diff --git a/docs/examples/album.tsx b/docs/examples/album.tsx index a7df9898..d4430cd2 100644 --- a/docs/examples/album.tsx +++ b/docs/examples/album.tsx @@ -1,11 +1,13 @@ import Image from 'rc-image'; import React from 'react'; import '../../assets/index.less'; +import { defaultIcons } from './common'; export default function PreviewGroup() { return (
diff --git a/docs/examples/basic.tsx b/docs/examples/basic.tsx index 186916d7..67d2b174 100644 --- a/docs/examples/basic.tsx +++ b/docs/examples/basic.tsx @@ -1,28 +1,8 @@ -import { - CloseOutlined, - LeftOutlined, - RightOutlined, - RotateLeftOutlined, - RotateRightOutlined, - SwapOutlined, - ZoomInOutlined, - ZoomOutOutlined, -} from '@ant-design/icons'; import Image from 'rc-image'; import * as React from 'react'; import '../../assets/index.less'; +import { defaultIcons } from './common'; -const icons = { - rotateLeft: , - rotateRight: , - zoomIn: , - zoomOut: , - close: , - left: , - right: , - flipX: , - flipY: , -}; export default function Base() { return ( @@ -37,7 +17,7 @@ export default function Base() { console.log('click'); }} preview={{ - icons, + icons: defaultIcons, onVisibleChange: visible => { console.log('visible', visible); }, @@ -51,7 +31,7 @@ export default function Base() { style={{ marginRight: 24, }} - preview={{ mask: 'Click to Preview' }} + preview={{ icons: defaultIcons, mask: 'Click to Preview' }} />
); diff --git a/docs/examples/common.tsx b/docs/examples/common.tsx new file mode 100644 index 00000000..5ec407a3 --- /dev/null +++ b/docs/examples/common.tsx @@ -0,0 +1,25 @@ + +import React from 'react'; +import type { PreviewProps } from '@/Preview'; +import { + CloseOutlined, + LeftOutlined, + RightOutlined, + RotateLeftOutlined, + RotateRightOutlined, + SwapOutlined, + ZoomInOutlined, + ZoomOutOutlined, + } from '@ant-design/icons'; + + export const defaultIcons: PreviewProps['icons'] = { + rotateLeft: , + rotateRight: , + zoomIn: , + zoomOut: , + close: , + left: , + right: , + flipX: , + flipY: , + }; \ No newline at end of file diff --git a/docs/examples/controlled.tsx b/docs/examples/controlled.tsx index 0e6fbe5a..6ae65ac6 100644 --- a/docs/examples/controlled.tsx +++ b/docs/examples/controlled.tsx @@ -1,6 +1,7 @@ import * as React from 'react'; import Image from 'rc-image'; import '../../assets/index.less'; +import { defaultIcons } from './common'; export default function Base() { const [visible, setVisible] = React.useState(false); @@ -20,6 +21,7 @@ export default function Base() { src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" width={200} preview={{ + icons: defaultIcons, visible, onVisibleChange: value => { setVisible(value); diff --git a/docs/examples/controlledWithGroup.tsx b/docs/examples/controlledWithGroup.tsx index ec6fa03f..3120df93 100644 --- a/docs/examples/controlledWithGroup.tsx +++ b/docs/examples/controlledWithGroup.tsx @@ -2,6 +2,7 @@ import * as React from 'react'; import Image from 'rc-image'; import '../../assets/index.less'; +import { defaultIcons } from './common'; export default function Base() { const [visible, setVisible] = React.useState(false); @@ -19,6 +20,7 @@ export default function Base() { { setVisible(value); diff --git a/docs/examples/fallback.tsx b/docs/examples/fallback.tsx index 1643243f..7393568c 100644 --- a/docs/examples/fallback.tsx +++ b/docs/examples/fallback.tsx @@ -1,11 +1,12 @@ import * as React from 'react'; import Image from 'rc-image'; import '../../assets/index.less'; +import { defaultIcons } from './common'; export default function Base() { return ( null, imageRender: () => (