Skip to content
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

refactor(odyssey-react-mui): use component class name variables #1853

Merged
merged 1 commit into from
Jun 27, 2023
Merged
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
32 changes: 17 additions & 15 deletions packages/odyssey-react-mui/src/theme/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ import { ThemeOptions } from "@mui/material";
import type {} from "@mui/lab/themeAugmentation";
import { alertTitleClasses } from "@mui/material/AlertTitle";
import { buttonClasses } from "@mui/material/Button";
import { checkboxClasses } from "@mui/material/Checkbox";
import { chipClasses } from "@mui/material/Chip";
import { dialogActionsClasses } from "@mui/material/DialogActions";
import { dividerClasses } from "@mui/material/Divider";
import { formControlLabelClasses } from "@mui/material/FormControlLabel";
import { formLabelClasses } from "@mui/material/FormLabel";
import { inputAdornmentClasses } from "@mui/material/InputAdornment";
import { inputBaseClasses } from "@mui/material/InputBase";
import { listItemIconClasses } from "@mui/material/ListItemIcon";
import { listItemTextClasses } from "@mui/material/ListItemText";
import { menuItemClasses } from "@mui/material/MenuItem";
import { radioClasses } from "@mui/material/Radio";
import { stackClasses } from "@mui/material/Stack";
import { svgIconClasses } from "@mui/material/SvgIcon";
import { tableBodyClasses } from "@mui/material/TableBody";
Expand All @@ -30,6 +34,7 @@ import { tableHeadClasses } from "@mui/material/TableHead";
import { tableRowClasses } from "@mui/material/TableRow";
import { tableSortLabelClasses } from "@mui/material/TableSortLabel";
import { tooltipClasses } from "@mui/material/Tooltip";
import { typographyClasses } from "@mui/material/Typography";

import {
AlertTriangleFilledIcon,
Expand Down Expand Up @@ -437,7 +442,7 @@ export const components = (
lineHeight: odysseyTokens.TypographyLineHeightUi,
whiteSpace: "nowrap",

".MuiButton-root + &": {
[`.${buttonClasses.root} + &`]: {
marginInlineStart: odysseyTokens.Spacing2,
},

Expand Down Expand Up @@ -513,7 +518,7 @@ export const components = (
}
),

".MuiSvgIcon-root": {
[`.${svgIconClasses.root}`]: {
color: theme.palette.common.white,
transition: theme.transitions.create(["color"], {
duration: theme.transitions.duration.short,
Expand All @@ -524,13 +529,13 @@ export const components = (
backgroundColor: odysseyTokens.PalettePrimaryMain,
borderColor: odysseyTokens.PalettePrimaryMain,

".MuiFormControlLabel-root:hover > &": {
[`.${formControlLabelClasses.root}:hover > &`]: {
backgroundColor: theme.palette.primary.dark,
borderColor: theme.palette.primary.dark,
},
},

".MuiFormControlLabel-root:hover > &": {
[`.${formControlLabelClasses.root}:hover > &`]: {
backgroundColor: "transparent",
borderColor: theme.palette.grey[900],
},
Expand Down Expand Up @@ -569,7 +574,7 @@ export const components = (
borderColor: odysseyTokens.HueNeutral300,
},

".MuiSvgIcon-root": {
[`.${svgIconClasses.root}`]: {
color: theme.palette.common.black,
},
},
Expand Down Expand Up @@ -1221,21 +1226,18 @@ export const components = (
"&.Mui-disabled": {
pointerEvents: "none",
},
//[`&:hover ${radioClasses.root}:not(${radioClasses.checked})`]: {
//color: odysseyTokens.TypographyColorBody,
//},
"&:hover .MuiRadio-root, &:hover .MuiCheckbox-root": {
[`&:hover .${radioClasses.root}, &:hover .${checkboxClasses.root}`]: {
color: odysseyTokens.TypographyColorBody,
},
"&:hover .MuiRadio-root.Mui-checked, &:hover .MuiCheckbox-root.Mui-checked":
[`&:hover .${radioClasses.root}.Mui-checked, &:hover .${checkboxClasses.root}.Mui-checked`]:
{
color: theme.palette.primary.dark,
},
"&.Mui-error:hover .MuiRadio-root, &.Mui-error:hover .MuiCheckbox-root":
[`&.Mui-error:hover .${radioClasses.root}, &.Mui-error:hover .${checkboxClasses.root}`]:
{
color: odysseyTokens.PaletteDangerDark,
},
"&.Mui-error:hover .MuiRadio-root.Mui-checked, &.Mui-error:hover .MuiCheckbox-root.Mui-checked":
[`&.Mui-error:hover .${radioClasses.root}.Mui-checked, &.Mui-error:hover .${checkboxClasses.root}.Mui-checked`]:
{
color: odysseyTokens.PaletteDangerDark,
},
Expand All @@ -1259,7 +1261,7 @@ export const components = (
fontSize: theme.typography.subtitle1.fontSize,
lineHeight: "1.33333333",
marginBlockStart: odysseyTokens.Spacing2,
".MuiFormLabel-root + &": {
[`.${formLabelClasses.root} + &`]: {
marginBlockStart: `-${theme.spacing(1)}`,
color: odysseyTokens.TypographyColorSub,
},
Expand Down Expand Up @@ -1464,7 +1466,7 @@ export const components = (
transform: "none",
}),
}),
"& > .MuiTypography-root": {
[`& > .${typographyClasses.root}`]: {
lineHeight: "unset",
},
}),
Expand Down Expand Up @@ -1687,7 +1689,7 @@ export const components = (
}),
},

".MuiFormControlLabel-root:hover > &": {
[`.${formControlLabelClasses.root}:hover > &`]: {
backgroundColor: "transparent",
borderColor: theme.palette.grey[900],
},
Expand Down