Skip to content

Commit

Permalink
Check for theme vars
Browse files Browse the repository at this point in the history
  • Loading branch information
aarongarciah committed Apr 9, 2024
1 parent 469ef99 commit 54e92e9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/mui-material/src/SvgIcon/SvgIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const SvgIconRoot = styled('svg', {
display: 'inline-block',
flexShrink: 0,
transition: theme.transitions?.create?.('fill', {
duration: theme.transitions?.duration?.shorter,
duration: (theme.vars ?? theme).transitions?.duration?.shorter,
}),
variants: [
{
Expand Down Expand Up @@ -70,19 +70,19 @@ const SvgIconRoot = styled('svg', {
style: { fontSize: theme.typography?.pxToRem?.(35) || '2.1875rem' },
},
// TODO v5 deprecate color prop, v6 remove for sx
...Object.entries(theme.palette)
.filter(([, value]) => value.main || value.action || value.disabled)
.map(([color]) => ({
...Object.entries((theme.vars ?? theme).palette)
.filter(([, value]) => value.main)
.map(([color, value]) => ({
props: { color },
style: { color: theme.palette?.[color]?.main },
style: { color: value.main },
})),
{
props: { color: 'action' },
style: { color: theme.palette?.action?.active },
style: { color: (theme.vars ?? theme).palette?.action?.active },
},
{
props: { color: 'disabled' },
style: { color: theme.palette?.action?.disabled },
style: { color: (theme.vars ?? theme).palette?.action?.disabled },
},
{
props: { color: 'inherit' },
Expand Down

0 comments on commit 54e92e9

Please sign in to comment.