From c82b798c5fb9c67674d8b01c632860f34eb7b08c Mon Sep 17 00:00:00 2001 From: TingShine <791405318@qq.com> Date: Fri, 11 Nov 2022 16:29:35 +0800 Subject: [PATCH] docs(image): update image demo --- src/image/_example/base.jsx | 14 ---- src/image/_example/crop.jsx | 24 +++++++ src/image/_example/error.jsx | 19 ------ src/image/_example/fit.jsx | 32 --------- src/image/_example/index.jsx | 97 +++------------------------- src/image/_example/lazy.jsx | 14 ---- src/image/_example/loading-error.jsx | 24 +++++++ src/image/_example/loading-tip.jsx | 21 ++++++ src/image/_example/loading.jsx | 17 ----- src/image/_example/position.jsx | 36 ----------- src/image/_example/rounded.jsx | 24 +++++++ src/image/_example/shape.jsx | 26 -------- src/image/_example/size.jsx | 38 +++++++++++ 13 files changed, 141 insertions(+), 245 deletions(-) delete mode 100644 src/image/_example/base.jsx create mode 100644 src/image/_example/crop.jsx delete mode 100644 src/image/_example/error.jsx delete mode 100644 src/image/_example/fit.jsx delete mode 100644 src/image/_example/lazy.jsx create mode 100644 src/image/_example/loading-error.jsx create mode 100644 src/image/_example/loading-tip.jsx delete mode 100644 src/image/_example/loading.jsx delete mode 100644 src/image/_example/position.jsx create mode 100644 src/image/_example/rounded.jsx delete mode 100644 src/image/_example/shape.jsx create mode 100644 src/image/_example/size.jsx diff --git a/src/image/_example/base.jsx b/src/image/_example/base.jsx deleted file mode 100644 index 63f7cbdf..00000000 --- a/src/image/_example/base.jsx +++ /dev/null @@ -1,14 +0,0 @@ -import React from 'react'; -import { Image } from 'tdesign-mobile-react'; - -const BaseUsage = React.memo(() => ( -
- 这是一张图片 -
-)); - -export default BaseUsage; diff --git a/src/image/_example/crop.jsx b/src/image/_example/crop.jsx new file mode 100644 index 00000000..ab30d3bd --- /dev/null +++ b/src/image/_example/crop.jsx @@ -0,0 +1,24 @@ +import React from 'react'; +import { Image } from 'tdesign-mobile-react'; +import './style/index.less'; + +const CropDemo = React.memo(() => ( + <> +
+
+ +
裁切
+
+
+ +
适应高
+
+
+ +
拉伸
+
+
+ +)); + +export default CropDemo; diff --git a/src/image/_example/error.jsx b/src/image/_example/error.jsx deleted file mode 100644 index b7fc7c49..00000000 --- a/src/image/_example/error.jsx +++ /dev/null @@ -1,19 +0,0 @@ -import React from 'react'; -import { Image } from 'tdesign-mobile-react'; - -const ErrorUsage = React.memo(() => ( -
- - - 加载失败} - /> -
-)); - -export default ErrorUsage; diff --git a/src/image/_example/fit.jsx b/src/image/_example/fit.jsx deleted file mode 100644 index 6dfea24b..00000000 --- a/src/image/_example/fit.jsx +++ /dev/null @@ -1,32 +0,0 @@ -import React from 'react'; -import { Image } from 'tdesign-mobile-react'; - -const FitUsage = React.memo(() => ( -
- - - - - - - -
-)); - -export default FitUsage; diff --git a/src/image/_example/index.jsx b/src/image/_example/index.jsx index b5a333ab..82242995 100644 --- a/src/image/_example/index.jsx +++ b/src/image/_example/index.jsx @@ -1,109 +1,32 @@ import React from 'react'; -import { Image } from 'tdesign-mobile-react'; -import { LoadingIcon } from 'tdesign-icons-react'; import TDemoBlock from '../../../site/mobile/components/DemoBlock'; import TDemoHeader from '../../../site/mobile/components/DemoHeader'; -import './style/index.less'; +import CropDemo from './crop'; +import RoundDemo from './rounded'; +import LoadingTipDemo from './loading-tip'; +import LoadingErrorDemo from './loading-error'; +import SizeDemo from './size'; export default function Base() { return ( <> -
-
- -
裁切
-
-
- -
适应高
-
-
- -
拉伸
-
-
+
- -
-
- -
方形
-
-
- -
圆角方形
-
-
- -
圆角
-
-
+
-
-
- -
默认提示
-
-
- } style={{ width: 72, height: 72 }} /> -
自定义提示
-
-
+
- -
-
- -
默认提示
-
-
- 加载失败} - style={{ width: 72, height: 72 }} - /> -
自定义提示
-
-
+
-
-
- -
图片 56
-
- -
- -
图片 48
-
- -
- -
图片 32
-
- -
- -
图片 24
-
-
- -
图片 120
-
- -
- -
图片 72
-
-
+
); diff --git a/src/image/_example/lazy.jsx b/src/image/_example/lazy.jsx deleted file mode 100644 index 9d8f45a9..00000000 --- a/src/image/_example/lazy.jsx +++ /dev/null @@ -1,14 +0,0 @@ -import React from 'react'; -import { Image } from 'tdesign-mobile-react'; - -const LazyUsage = React.memo(() => ( -
- -
-)); - -export default LazyUsage; diff --git a/src/image/_example/loading-error.jsx b/src/image/_example/loading-error.jsx new file mode 100644 index 00000000..2b684807 --- /dev/null +++ b/src/image/_example/loading-error.jsx @@ -0,0 +1,24 @@ +import React from 'react'; +import { Image } from 'tdesign-mobile-react'; +import './style/index.less'; + +const LoadingErrorDemo = React.memo(() => ( + <> +
+
+ +
默认提示
+
+
+ 加载失败} + style={{ width: 72, height: 72 }} + /> +
自定义提示
+
+
+ +)); + +export default LoadingErrorDemo; diff --git a/src/image/_example/loading-tip.jsx b/src/image/_example/loading-tip.jsx new file mode 100644 index 00000000..f8e8c681 --- /dev/null +++ b/src/image/_example/loading-tip.jsx @@ -0,0 +1,21 @@ +import React from 'react'; +import { Image } from 'tdesign-mobile-react'; +import { LoadingIcon } from 'tdesign-icons-react'; +import './style/index.less'; + +const LoadingTipDemo = React.memo(() => ( + <> +
+
+ +
默认提示
+
+
+ } style={{ width: 72, height: 72 }} /> +
自定义提示
+
+
+ +)); + +export default LoadingTipDemo; diff --git a/src/image/_example/loading.jsx b/src/image/_example/loading.jsx deleted file mode 100644 index 3544c6af..00000000 --- a/src/image/_example/loading.jsx +++ /dev/null @@ -1,17 +0,0 @@ -import React from 'react'; -import { Image } from 'tdesign-mobile-react'; -import { LoadingIcon } from 'tdesign-icons-react'; - -const LoadingUsage = React.memo(() => ( -
- - - } - /> -
-)); - -export default LoadingUsage; diff --git a/src/image/_example/position.jsx b/src/image/_example/position.jsx deleted file mode 100644 index 5310b135..00000000 --- a/src/image/_example/position.jsx +++ /dev/null @@ -1,36 +0,0 @@ -import React from 'react'; -import { Image } from 'tdesign-mobile-react'; - -const PositionUsage = React.memo(() => ( -
- - - - - - - -
-)); - -export default PositionUsage; diff --git a/src/image/_example/rounded.jsx b/src/image/_example/rounded.jsx new file mode 100644 index 00000000..2a39cd22 --- /dev/null +++ b/src/image/_example/rounded.jsx @@ -0,0 +1,24 @@ +import React from 'react'; +import { Image } from 'tdesign-mobile-react'; +import './style/index.less'; + +const RoundDemo = React.memo(() => ( + <> +
+
+ +
方形
+
+
+ +
圆角方形
+
+
+ +
圆角
+
+
+ +)); + +export default RoundDemo; diff --git a/src/image/_example/shape.jsx b/src/image/_example/shape.jsx deleted file mode 100644 index 3231ad50..00000000 --- a/src/image/_example/shape.jsx +++ /dev/null @@ -1,26 +0,0 @@ -import React from 'react'; -import { Image } from 'tdesign-mobile-react'; - -const ShapeUsage = React.memo(() => ( -
- - - - - -
-)); - -export default ShapeUsage; diff --git a/src/image/_example/size.jsx b/src/image/_example/size.jsx new file mode 100644 index 00000000..75b557fc --- /dev/null +++ b/src/image/_example/size.jsx @@ -0,0 +1,38 @@ +import React from 'react'; +import { Image } from 'tdesign-mobile-react'; +import './style/index.less'; + +const SizeDemo = React.memo(() => ( +
+
+ +
图片 56
+
+ +
+ +
图片 48
+
+ +
+ +
图片 32
+
+ +
+ +
图片 24
+
+
+ +
图片 120
+
+ +
+ +
图片 72
+
+
+)); + +export default SizeDemo;