Skip to content

Commit a30409f

Browse files
committed
Stacked bar: improve
1 parent 217346f commit a30409f

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

src/common/components/StackedBarBreakdown.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ export function StackedBarBreakdown({ segments, title, showValues = false, value
4343
{/* The stacked bar */}
4444
<Box sx={{
4545
display: 'flex',
46-
height: 8,
47-
borderRadius: 8,
46+
height: 10,
47+
borderRadius: 'sm',
4848
overflow: 'hidden',
49+
boxShadow: 'xs',
4950
my: 1,
5051
}}>
5152
{nonZeroSegments.map(({ key, value, color }) => {
@@ -57,20 +58,23 @@ export function StackedBarBreakdown({ segments, title, showValues = false, value
5758
sx={{
5859
width: `${percentage}%`,
5960
backgroundColor: color,
60-
transition: 'width 0.3s ease-in-out',
61+
// transition: 'width 0.3s ease-in-out',
6162
}}
6263
/>
6364
);
6465
})}
6566
</Box>
6667

6768
{/* Legend with colored squares */}
68-
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1 }}>
69+
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 2 }}>
6970
{nonZeroSegments.map(({ key, label, value, color }) => {
7071
const percentage = (value / total) * 100;
7172
return (
7273
<Box key={key} sx={{ display: 'flex', alignItems: 'center', gap: 0.5 }}>
73-
<Box sx={{ width: 10, height: 10, backgroundColor: color, borderRadius: 2 }} />
74+
<Box sx={{
75+
width: 10, height: 10, backgroundColor: color, borderRadius: 'sm',
76+
boxShadow: 'xs'
77+
}} />
7478
<Typography level='body-xs'>
7579
{label} {showValues
7680
? `${valueFormatter(value)} (${percentage.toFixed(0)}%)`

0 commit comments

Comments
 (0)