Skip to content

Commit

Permalink
fix(Progress): StrokeLinecap style
Browse files Browse the repository at this point in the history
  • Loading branch information
ZN1996 committed Dec 20, 2023
1 parent 5393d9c commit 1458d88
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions components/progress/Line.tsx
Expand Up @@ -108,14 +108,16 @@ const Line: React.FC<LineProps> = (props) => {
warning.deprecated(!('strokeWidth' in props), 'strokeWidth', 'size');
}

const percentBorderRadius = strokeLinecap === 'square' || strokeLinecap === 'butt' ? 0 : '100px';

const percentStyle: React.CSSProperties = {
width: `100%`,
height,
borderRadius,
clipPath:
direction === 'rtl'
? `inset(0 0 0 ${100 - validProgress(percent)}% round 100px)`
: `inset(0 ${100 - validProgress(percent)}% 0 0 round 100px)`,
? `inset(0 0 0 ${100 - validProgress(percent)}% round ${percentBorderRadius})`
: `inset(0 ${100 - validProgress(percent)}% 0 0 round ${percentBorderRadius})`,
...backgroundProps,
};

Expand All @@ -127,8 +129,8 @@ const Line: React.FC<LineProps> = (props) => {
borderRadius,
clipPath:
direction === 'rtl'
? `inset(0 0 0 ${100 - validProgress(successPercent)}% round 100px)`
: `inset(0 ${100 - validProgress(successPercent)}% 0 0 round 100px)`,
? `inset(0 0 0 ${100 - validProgress(successPercent)}% round ${percentBorderRadius})`
: `inset(0 ${100 - validProgress(successPercent)}% 0 0 round ${percentBorderRadius})`,
backgroundColor: success?.strokeColor,
};

Expand Down
Expand Up @@ -2410,7 +2410,7 @@ Array [
>
<div
class="ant-progress-bg"
style="width: 100%; height: 8px; border-radius: 0; clip-path: inset(0 25% 0 0 round 100px);"
style="width: 100%; height: 8px; border-radius: 0; clip-path: inset(0 25% 0 0 round 0);"
/>
</div>
</div>
Expand Down
Expand Up @@ -2318,7 +2318,7 @@ Array [
>
<div
class="ant-progress-bg"
style="width:100%;height:8px;border-radius:0;clip-path:inset(0 25% 0 0 round 100px)"
style="width:100%;height:8px;border-radius:0;clip-path:inset(0 25% 0 0 round 0)"
/>
</div>
</div>
Expand Down

0 comments on commit 1458d88

Please sign in to comment.