Skip to content

Commit

Permalink
Merge pull request #753 from thundersdata-frontend/feat/lego
Browse files Browse the repository at this point in the history
fix: 乐高组件的一些优化
  • Loading branch information
chj-damon authored Nov 2, 2023
2 parents 3c544e0 + fdb209e commit 3028d45
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 30 deletions.
5 changes: 5 additions & 0 deletions .changeset/dull-fishes-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@td-design/lego': patch
---

fix: lego组件的一些优化
3 changes: 1 addition & 2 deletions packages/lego/example/ModalDemo/demo1.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ export default () => {
return (
<>
<Button onClick={() => setVisible(true)}>显示弹窗</Button>
<Modal visible={visible} onClose={() => setVisible(false)} >
</Modal>
<Modal visible={visible} onClose={() => setVisible(false)} />
</>
);
};
1 change: 0 additions & 1 deletion packages/lego/example/ProgressDemo/demo2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export default () => {
{ name: '成都', value: 38 },
]}
inModal
style={{ height: 500 }}
/>
</Modal>
</>
Expand Down
1 change: 0 additions & 1 deletion packages/lego/example/RadarDemo/demo2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export default () => {
>
<Radar
inModal
style={{ height: 500 }}
seriesData={seriesData}
indicatorData={indicatorData}
/>
Expand Down
15 changes: 0 additions & 15 deletions packages/lego/src/data-show/assets/rectangle.svg

This file was deleted.

2 changes: 1 addition & 1 deletion packages/lego/src/data-show/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -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%;

Expand Down
2 changes: 1 addition & 1 deletion packages/lego/src/img-pie/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@{prefix}-image {
position: absolute;
top: 50%;
left: 50%;
left: 49.5%;
transform: translate(-50%, -50%);
}

Expand Down
5 changes: 4 additions & 1 deletion packages/lego/src/progress/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ export interface ProgressProps {
* 进度条图,对应Figma其他图6
*/
export default forwardRef<ReactEcharts, ProgressProps>(
({ 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);
Expand Down
2 changes: 1 addition & 1 deletion packages/lego/src/radar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default forwardRef<ReactEcharts, RadarProps>(
max: 100,
},
],
style,
style = { width: 500, height: 500 },
config,
inModal = false,
radarColors = [],
Expand Down
11 changes: 6 additions & 5 deletions packages/lego/src/swiper/index.less
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
9 changes: 7 additions & 2 deletions packages/lego/src/swiper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export interface CustomSwiperProps {
const CustomSwiper = forwardRef<any, CustomSwiperProps>(
({ 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();

Expand Down Expand Up @@ -75,13 +76,17 @@ const CustomSwiper = forwardRef<any, CustomSwiperProps>(
style={{
width: 692,
height: 297,
paddingBottom: 40,
paddingBottom,
...style,
}}
/>
</SwiperSlide>
))
: list.map((ele, index) => <SwiperSlide key={index}>{ele}</SwiperSlide>)}
: list.map((ele, index) => (
<SwiperSlide key={index} style={{ paddingBottom, ...style }}>
{ele}
</SwiperSlide>
))}
</Swiper>
) : null}
</div>
Expand Down

0 comments on commit 3028d45

Please sign in to comment.