Skip to content

[docs] Fix displaying of components in dark mode #46544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ const StatRoot = styled('div')(({ theme }) => ({
boxShadow: theme.shadows[2],
letterSpacing: '-0.025em',
fontWeight: 600,
...theme.applyStyles('dark', {
backgroundColor: 'inherit',
}),
}));

const StatValue = styled('div')(({ theme }) => ({
Expand All @@ -20,6 +23,9 @@ const StatValue = styled('div')(({ theme }) => ({
const StatUnit = styled('div')(({ theme }) => ({
...theme.typography.body2,
color: theme.palette.text.secondary,
...theme.applyStyles('dark', {
color: 'inherit',
}),
}));

export default function StatComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ const StatRoot = styled('div', {
},
},
],
...theme.applyStyles('dark', {
backgroundColor: 'inherit',
}),
}));

const StatValue = styled('div', {
Expand All @@ -42,6 +45,9 @@ const StatUnit = styled('div', {
})(({ theme }) => ({
...theme.typography.body2,
color: theme.palette.text.secondary,
...theme.applyStyles('dark', {
color: 'inherit',
}),
}));

const Stat = React.forwardRef(function Stat(inProps, ref) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ const StatRoot = styled('div', {
},
},
],
...theme.applyStyles('dark', {
backgroundColor: 'inherit',
}),
}));

const StatValue = styled('div', {
Expand All @@ -52,6 +55,9 @@ const StatUnit = styled('div', {
})<{ ownerState: StatOwnerState }>(({ theme }) => ({
...theme.typography.body2,
color: theme.palette.text.secondary,
...theme.applyStyles('dark', {
color: 'inherit',
}),
}));

const Stat = React.forwardRef<HTMLDivElement, StatProps>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ const StatRoot = styled('div')(({ theme }) => ({
boxShadow: theme.shadows[2],
letterSpacing: '-0.025em',
fontWeight: 600,
...theme.applyStyles('dark', {
backgroundColor: 'inherit',
}),
}));

const StatValue = styled('div')(({ theme }) => ({
Expand All @@ -20,6 +23,9 @@ const StatValue = styled('div')(({ theme }) => ({
const StatUnit = styled('div')(({ theme }) => ({
...theme.typography.body2,
color: theme.palette.text.secondary,
...theme.applyStyles('dark', {
color: 'inherit',
}),
}));

const Label = styled('div')(({ theme }) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ const StatRoot = styled('div', {
boxShadow: theme.shadows[2],
letterSpacing: '-0.025em',
fontWeight: 600,
...theme.applyStyles('dark', {
backgroundColor: 'inherit',
}),
}));

const StatValue = styled('div', {
Expand Down Expand Up @@ -181,6 +184,9 @@ Then you can read `ownerState` in the slot to style it based on the `variant` pr
boxShadow: theme.shadows[2],
letterSpacing: '-0.025em',
fontWeight: 600,
...theme.applyStyles('dark', {
backgroundColor: 'inherit',
}),
+ ...ownerState.variant === 'outlined' && {
+ border: `2px solid ${theme.palette.divider}`,
+ },
Expand Down Expand Up @@ -257,6 +263,9 @@ const StatRoot = styled('div', {
boxShadow: theme.shadows[2],
letterSpacing: '-0.025em',
fontWeight: 600,
...theme.applyStyles('dark', {
backgroundColor: 'inherit',
}),
// typed-safe access to the `variant` prop
...(ownerState.variant === 'outlined' && {
border: `2px solid ${theme.palette.divider}`,
Expand Down
Loading