Skip to content

Commit 86db7e8

Browse files
authored
[site] 修复分片过多导致进度条显示溢出的问题 (qiniu#544)
* 修复分片过多导致进度条显示溢出的问题
1 parent 3f6632f commit 86db7e8

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

site/src/components/Queue/item.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,15 @@ function ProgressBar(props: { progress: UploadProgress | null }) {
9393
return []
9494
}, [props.progress])
9595

96+
// 一行以内就需要撑开
97+
const isExpanded = chunks.length < 18
98+
9699
return (
97100
<ul className={classnames.progressBar}>
98101
{chunks.map((chunk, index) => {
99102
const cacheName = chunk.fromCache ? classnames.cachedChunk : ''
100103
return (
101-
<li key={index}>
104+
<li key={index} className={isExpanded ? classnames.expanded : ''}>
102105
<span className={cacheName} style={{ width: chunk.percent + '%' }}>
103106
</span>
104107
</li>

site/src/components/Queue/style.less

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,23 @@
6464
position: relative;
6565

6666
display: flex;
67+
flex-wrap: wrap;
6768
flex-direction: row;
6869
align-items: center;
6970

7071
list-style: none;
7172
padding-inline-start: 0;
7273

73-
li {
74+
.expanded {
7475
flex: 1;
76+
}
77+
78+
li {
79+
margin: 1px;
7580
padding: 1px;
76-
margin: 0 1px;
81+
min-width: 4px;
7782
border-radius: 2px;
78-
border:#333 solid 1px;
83+
border: #333 solid 1px;
7984

8085
span {
8186
height: 10px;

0 commit comments

Comments
 (0)