Skip to content

Commit 5db3f5a

Browse files
committed
#1720 remove unnecessary styled wrapper
1 parent edbd09d commit 5db3f5a

File tree

1 file changed

+13
-50
lines changed

1 file changed

+13
-50
lines changed

client/packages/lowcoder/src/comps/comps/fileComp/draggerUpload.tsx

Lines changed: 13 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ const IconWrapper = styled.span`
1919
display: flex;
2020
`;
2121

22-
const DraggerShell = styled.div<{ $auto: boolean }>`
22+
const DraggerShell = styled(AntdUpload.Dragger)<{ $auto: boolean
23+
$style: FileStyleType
24+
}>`
2325
height: ${(p) => (p.$auto ? "auto" : "100%")};
2426
2527
/* AntD wraps dragger + list in this */
26-
.ant-upload-wrapper {
28+
&.ant-upload-wrapper {
2729
display: flex;
2830
flex-direction: column;
2931
height: 100%;
@@ -39,6 +41,12 @@ const DraggerShell = styled.div<{ $auto: boolean }>`
3941
min-height: 120px;
4042
min-width: 0;
4143
`}
44+
.ant-upload-drag-container {
45+
.ant-upload-drag-icon {
46+
display: flex;
47+
justify-content: center;
48+
}
49+
}
4250
}
4351
4452
/* The list sits below the dragger */
@@ -50,50 +58,6 @@ const DraggerShell = styled.div<{ $auto: boolean }>`
5058
`}
5159
}
5260
`;
53-
54-
55-
const StyledDragger = styled(AntdUpload.Dragger)<{
56-
$style: FileStyleType;
57-
$auto: boolean;
58-
}>`
59-
&.ant-upload-drag {
60-
border-color: ${(p) => p.$style.border};
61-
border-width: ${(p) => p.$style.borderWidth};
62-
border-style: ${(p) => p.$style.borderStyle};
63-
border-radius: ${(p) => p.$style.radius};
64-
background: ${(p) => p.$style.background};
65-
66-
${(p) =>
67-
!p.$auto &&
68-
`
69-
display: flex;
70-
align-items: center;
71-
`}
72-
73-
${(p) =>
74-
p.$auto &&
75-
`
76-
min-height: 200px;
77-
`}
78-
79-
.ant-upload-drag-container {
80-
${(p) =>
81-
!p.$auto &&
82-
`
83-
display: flex;
84-
flex-direction: column;
85-
justify-content: center;
86-
height: 100%;
87-
`}
88-
}
89-
90-
&:hover {
91-
border-color: ${(p) => p.$style.accent};
92-
}
93-
}
94-
`;
95-
96-
9761
interface DraggerUploadProps {
9862
value: Array<string | null>;
9963
files: any[];
@@ -202,8 +166,7 @@ export const DraggerUpload = (props: DraggerUploadProps) => {
202166
};
203167

204168
return (
205-
<DraggerShell $auto={autoHeight}>
206-
<StyledDragger
169+
<DraggerShell
207170
{...commonProps(props)}
208171
fileList={fileList}
209172
$style={style}
@@ -240,7 +203,7 @@ export const DraggerUpload = (props: DraggerUploadProps) => {
240203
<p className="ant-upload-hint">
241204
{props.dragHintText}
242205
</p>
243-
</StyledDragger>
244-
</DraggerShell>
206+
</DraggerShell>
207+
245208
);
246209
};

0 commit comments

Comments
 (0)