Skip to content

Commit

Permalink
[joy-ui][Progress] Revamp Linear and Circular progress variants (#39492)
Browse files Browse the repository at this point in the history
Co-authored-by: siriwatknp <[email protected]>
  • Loading branch information
zanivan and siriwatknp authored Oct 26, 2023
1 parent 4b35e64 commit edcb46b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 12 deletions.
12 changes: 6 additions & 6 deletions docs/data/joy/components/alert/AlertInvertedColors.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,24 @@ export default function AlertInvertedColors() {
</Typography>
</div>
<LinearProgress
variant="soft"
variant="solid"
color="success"
value={40}
sx={(theme) => ({
sx={{
position: 'absolute',
bottom: 0,
left: 0,
right: 0,
color: `rgb(${theme.vars.palette.success.lightChannel} / 0.72)`,
'--LinearProgress-radius': '0px',
})}
borderRadius: 0,
}}
/>
</Alert>
<Alert
variant="soft"
color="danger"
invertedColors
startDecorator={
<CircularProgress size="lg">
<CircularProgress size="lg" color="danger">
<Warning />
</CircularProgress>
}
Expand Down
12 changes: 6 additions & 6 deletions docs/data/joy/components/alert/AlertInvertedColors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,24 @@ export default function AlertInvertedColors() {
</Typography>
</div>
<LinearProgress
variant="soft"
variant="solid"
color="success"
value={40}
sx={(theme) => ({
sx={{
position: 'absolute',
bottom: 0,
left: 0,
right: 0,
color: `rgb(${theme.vars.palette.success.lightChannel} / 0.72)`,
'--LinearProgress-radius': '0px',
})}
borderRadius: 0,
}}
/>
</Alert>
<Alert
variant="soft"
color="danger"
invertedColors
startDecorator={
<CircularProgress size="lg">
<CircularProgress size="lg" color="danger">
<Warning />
</CircularProgress>
}
Expand Down
9 changes: 9 additions & 0 deletions packages/mui-joy/src/CircularProgress/CircularProgress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,15 @@ const CircularProgressRoot = styled('span', {
...rest,
},
}),
...(ownerState.variant === 'soft' && {
'--CircularProgress-trackColor': theme.variants.soft.neutral.backgroundColor,
'--CircularProgress-progressColor': theme.variants.solid?.[ownerState.color!].backgroundColor,
}),
...(ownerState.variant === 'solid' && {
'--CircularProgress-trackColor':
theme.variants.softHover?.[ownerState.color!].backgroundColor,
'--CircularProgress-progressColor': theme.variants.solid?.[ownerState.color!].backgroundColor,
}),
};
});

Expand Down
8 changes: 8 additions & 0 deletions packages/mui-joy/src/LinearProgress/LinearProgress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ const LinearProgressRoot = styled('div', {
color: 'inherit',
position: 'absolute', // required to make `left` animation works.
},
...(ownerState.variant === 'soft' && {
backgroundColor: theme.variants.soft.neutral.backgroundColor,
color: theme.variants.solid?.[ownerState.color!].backgroundColor,
}),
...(ownerState.variant === 'solid' && {
backgroundColor: theme.variants.softHover?.[ownerState.color!].backgroundColor,
color: theme.variants.solid?.[ownerState.color!].backgroundColor,
}),
}),
({ ownerState }) =>
ownerState.determinate
Expand Down

0 comments on commit edcb46b

Please sign in to comment.