Skip to content

Commit a051d67

Browse files
committed
fix: use mask for dougnhut
1 parent 64cf1de commit a051d67

File tree

3 files changed

+6
-26
lines changed

3 files changed

+6
-26
lines changed

src/components/DoughnutMetrics/DoughnutMetrics.scss

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,9 @@
1313
aspect-ratio: 1;
1414

1515
border-radius: 50%;
16+
mask: radial-gradient(circle at center, transparent 46%, #000 46.5%);
1617

1718
transform: rotate(180deg);
18-
&::before {
19-
display: block;
20-
21-
height: calc(100% - calc(var(--doughnut-border) * 2));
22-
23-
content: '';
24-
25-
border-radius: 50%;
26-
background-color: var(--center-color, var(--g-color-base-background));
27-
28-
transform: translate(var(--doughnut-border), var(--doughnut-border));
29-
aspect-ratio: 1;
30-
}
3119
}
3220

3321
// Size modifiers - using visually centered values
@@ -61,8 +49,9 @@
6149
}
6250
&__text-wrapper {
6351
position: absolute;
52+
z-index: 1;
6453
top: var(--doughnut-wrapper-indent);
65-
right: var(--doughnut-wrapper-indent);
54+
left: var(--doughnut-wrapper-indent);
6655

6756
display: flex;
6857
flex-direction: column;
@@ -73,7 +62,6 @@
7362

7463
text-align: center;
7564

76-
transform: rotate(180deg);
7765
aspect-ratio: 1;
7866
}
7967

src/components/DoughnutMetrics/DoughnutMetrics.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ interface DoughnutProps {
5757
children?: React.ReactNode;
5858
className?: string;
5959
size?: 'small' | 'medium' | 'large';
60-
centerColor?: string;
6160
}
6261

6362
export function DoughnutMetrics({
@@ -66,7 +65,6 @@ export function DoughnutMetrics({
6665
children,
6766
className,
6867
size = 'medium',
69-
centerColor,
7068
}: DoughnutProps) {
7169
let filledDegrees = fillWidth * 3.6;
7270
let doughnutFillVar = 'var(--doughnut-color)';
@@ -80,15 +78,13 @@ export function DoughnutMetrics({
8078

8179
const doughnutStyle: React.CSSProperties = {
8280
background: `conic-gradient(${doughnutFillVar} 0deg ${filledDegrees}deg, ${doughnutBackdropVar} ${filledDegrees}deg 360deg)`,
83-
...(centerColor && ({'--center-color': centerColor} as React.CSSProperties)),
8481
};
8582

8683
return (
8784
<SizeContext.Provider value={size}>
88-
<div className={b(null, className)}>
89-
<div style={doughnutStyle} className={b('doughnut', {status, size})}>
90-
<div className={b('text-wrapper')}>{children}</div>
91-
</div>
85+
<div className={b(null, className)} style={{position: 'relative'}}>
86+
<div style={doughnutStyle} className={b('doughnut', {status, size})}></div>
87+
<div className={b('text-wrapper')}>{children}</div>
9288
</div>
9389
</SizeContext.Provider>
9490
);

src/containers/Tenant/Diagnostics/TenantOverview/TabCard/TabCard.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ export function TabCard({
4646
formattedValue = `${value} of ${limit}${unit ? ' ' + unit : ''}`;
4747
}
4848

49-
// Set center color based on card state
50-
const centerColor = active ? 'var(--g-color-base-background)' : 'var(--g-color-base-float)';
51-
5249
return (
5350
<div className={b({clickable, active})}>
5451
<Card
@@ -62,7 +59,6 @@ export function TabCard({
6259
status={status}
6360
fillWidth={percentage}
6461
className={b('doughnut')}
65-
centerColor={centerColor}
6662
>
6763
<DoughnutMetrics.Value variant="subheader-1">
6864
{formattedPercentage}

0 commit comments

Comments
 (0)