From 069382d8f6b012fcce75d2bd5769083eaa6bfa4e Mon Sep 17 00:00:00 2001 From: qiuyan Date: Thu, 2 Nov 2023 15:26:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B9=90=E9=AB=98=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E4=B8=80=E4=BA=9B=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/dull-fishes-compete.md | 5 +++++ packages/lego/example/ModalDemo/demo1.tsx | 3 +-- packages/lego/example/ProgressDemo/demo2.tsx | 1 - packages/lego/example/RadarDemo/demo2.tsx | 1 - packages/lego/src/data-show/assets/rectangle.svg | 15 --------------- packages/lego/src/data-show/index.less | 2 +- packages/lego/src/img-pie/index.less | 2 +- packages/lego/src/progress/index.tsx | 5 ++++- packages/lego/src/radar/index.tsx | 2 +- packages/lego/src/swiper/index.less | 11 ++++++----- packages/lego/src/swiper/index.tsx | 9 +++++++-- 11 files changed, 26 insertions(+), 30 deletions(-) create mode 100644 .changeset/dull-fishes-compete.md delete mode 100644 packages/lego/src/data-show/assets/rectangle.svg diff --git a/.changeset/dull-fishes-compete.md b/.changeset/dull-fishes-compete.md new file mode 100644 index 0000000000..8d5f2b231f --- /dev/null +++ b/.changeset/dull-fishes-compete.md @@ -0,0 +1,5 @@ +--- +'@td-design/lego': patch +--- + +fix: lego组件的一些优化 diff --git a/packages/lego/example/ModalDemo/demo1.tsx b/packages/lego/example/ModalDemo/demo1.tsx index d845a7ae94..b768f3b686 100644 --- a/packages/lego/example/ModalDemo/demo1.tsx +++ b/packages/lego/example/ModalDemo/demo1.tsx @@ -9,8 +9,7 @@ export default () => { return ( <> - setVisible(false)} > - + setVisible(false)} /> ); }; diff --git a/packages/lego/example/ProgressDemo/demo2.tsx b/packages/lego/example/ProgressDemo/demo2.tsx index 4137b88d0d..8d3890cdc5 100644 --- a/packages/lego/example/ProgressDemo/demo2.tsx +++ b/packages/lego/example/ProgressDemo/demo2.tsx @@ -22,7 +22,6 @@ export default () => { { name: '成都', value: 38 }, ]} inModal - style={{ height: 500 }} /> diff --git a/packages/lego/example/RadarDemo/demo2.tsx b/packages/lego/example/RadarDemo/demo2.tsx index 8b484542aa..6f7ea8b1da 100644 --- a/packages/lego/example/RadarDemo/demo2.tsx +++ b/packages/lego/example/RadarDemo/demo2.tsx @@ -36,7 +36,6 @@ export default () => { > diff --git a/packages/lego/src/data-show/assets/rectangle.svg b/packages/lego/src/data-show/assets/rectangle.svg deleted file mode 100644 index aa5c13e26c..0000000000 --- a/packages/lego/src/data-show/assets/rectangle.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/packages/lego/src/data-show/index.less b/packages/lego/src/data-show/index.less index 39ea3154ea..d20310652b 100644 --- a/packages/lego/src/data-show/index.less +++ b/packages/lego/src/data-show/index.less @@ -24,7 +24,7 @@ justify-content: center; width: 156px; height: 65px; - background-image: url('./assets/rectangle.svg'); + background-image: url('./assets/rectangle.png'); background-repeat: no-repeat; background-size: 100% 100%; diff --git a/packages/lego/src/img-pie/index.less b/packages/lego/src/img-pie/index.less index d0a7f3852c..940d0cf974 100644 --- a/packages/lego/src/img-pie/index.less +++ b/packages/lego/src/img-pie/index.less @@ -3,7 +3,7 @@ @{prefix}-image { position: absolute; top: 50%; - left: 50%; + left: 49.5%; transform: translate(-50%, -50%); } diff --git a/packages/lego/src/progress/index.tsx b/packages/lego/src/progress/index.tsx index 9ebd5e380f..104344b652 100644 --- a/packages/lego/src/progress/index.tsx +++ b/packages/lego/src/progress/index.tsx @@ -47,7 +47,10 @@ export interface ProgressProps { * 进度条图,对应Figma其他图6 */ export default forwardRef( - ({ name, data, style, config, inModal = false, onEvents, renderer = 'canvas' }, ref) => { + ( + { name, data, style = { width: 300, height: 300 }, config, inModal = false, onEvents, renderer = 'canvas' }, + ref + ) => { const theme = useTheme(); const baseChartConfig = useBaseChartConfig(inModal); const baseBarConfig = useBaseBarConfig(inModal); diff --git a/packages/lego/src/radar/index.tsx b/packages/lego/src/radar/index.tsx index 3f4d0a1501..b30de7cbbb 100644 --- a/packages/lego/src/radar/index.tsx +++ b/packages/lego/src/radar/index.tsx @@ -42,7 +42,7 @@ export default forwardRef( max: 100, }, ], - style, + style = { width: 500, height: 500 }, config, inModal = false, radarColors = [], diff --git a/packages/lego/src/swiper/index.less b/packages/lego/src/swiper/index.less index c2c6d4ca38..1c0e2203a0 100644 --- a/packages/lego/src/swiper/index.less +++ b/packages/lego/src/swiper/index.less @@ -1,9 +1,10 @@ .td-lego-swiper-container { - .swiper-container { - width: 100%; - min-height: 100px; - margin-top: -20px; - } + width: 100%; + min-height: 100px; + display: flex; + justify-content: center; + align-items: center; + .swiper-slide { display: -webkit-box; display: -ms-flexbox; diff --git a/packages/lego/src/swiper/index.tsx b/packages/lego/src/swiper/index.tsx index 848757f432..5487608c6d 100644 --- a/packages/lego/src/swiper/index.tsx +++ b/packages/lego/src/swiper/index.tsx @@ -27,6 +27,7 @@ export interface CustomSwiperProps { const CustomSwiper = forwardRef( ({ imgs = [], style, imgNumPerSlide = 1, autoplay, list = [], pagination }, ref) => { const auto = autoplay?.delay ? { pauseOnMouseEnter: true, disableOnInteraction: false, ...autoplay } : false; + const paddingBottom = pagination === false ? 0 : 40; const swiperInstance = useSwiper(); @@ -75,13 +76,17 @@ const CustomSwiper = forwardRef( style={{ width: 692, height: 297, - paddingBottom: 40, + paddingBottom, ...style, }} /> )) - : list.map((ele, index) => {ele})} + : list.map((ele, index) => ( + + {ele} + + ))} ) : null}