Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
refactor: use alpha() instead of fade
`fade()` was deprecated in favor of `alpha()` in a previous version of
`@material-ui/core/styles`.
  • Loading branch information
jsjoeio committed Sep 22, 2022
commit 72bcd1cf1860fba9e846c872b4ce44eda71986f1
6 changes: 3 additions & 3 deletions site/src/components/Dialogs/ConfirmDialog/ConfirmDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import DialogActions from "@material-ui/core/DialogActions"
import { fade, makeStyles } from "@material-ui/core/styles"
import { alpha, makeStyles } from "@material-ui/core/styles"
import Typography from "@material-ui/core/Typography"
import React, { ReactNode } from "react"
import { Dialog, DialogActionButtons, DialogActionButtonsProps } from "../Dialog"
Expand Down Expand Up @@ -65,11 +65,11 @@ const useStyles = makeStyles((theme) => ({
marginBottom: theme.spacing(3),
},
description: {
color: fade(theme.palette.text.secondary, 0.75),
color: alpha(theme.palette.text.secondary, 0.75),
lineHeight: "160%",

"& strong": {
color: fade(theme.palette.text.secondary, 0.95),
color: alpha(theme.palette.text.secondary, 0.95),
},
},
}))
Expand Down
36 changes: 18 additions & 18 deletions site/src/components/Dialogs/Dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import MuiDialog, { DialogProps as MuiDialogProps } from "@material-ui/core/Dialog"
import MuiDialogTitle from "@material-ui/core/DialogTitle"
import { darken, fade, lighten, makeStyles } from "@material-ui/core/styles"
import { alpha, darken, lighten, makeStyles } from "@material-ui/core/styles"
import SvgIcon from "@material-ui/core/SvgIcon"
import * as React from "react"
import { combineClasses } from "../../util/combineClasses"
Expand Down Expand Up @@ -57,7 +57,7 @@ const useTitleStyles = makeStyles(
icon: {
height: 84,
width: 84,
color: fade(theme.palette.action.disabled, 0.4),
color: alpha(theme.palette.action.disabled, 0.4),
},
}),
{ name: "CdrDialogTitle" },
Expand Down Expand Up @@ -155,27 +155,27 @@ const useButtonStyles = makeStyles((theme) => ({
boxShadow: "none",
},
cancelButton: {
background: fade(theme.palette.primary.main, 0.1),
background: alpha(theme.palette.primary.main, 0.1),
color: theme.palette.primary.main,

"&:hover": {
background: fade(theme.palette.primary.main, 0.3),
background: alpha(theme.palette.primary.main, 0.3),
},
},
confirmDialogCancelButton: (props: StyleProps) => {
const color =
props.type === "info" ? theme.palette.primary.contrastText : theme.palette.error.contrastText
return {
background: fade(color, 0.15),
background: alpha(color, 0.15),
color,

"&:hover": {
background: fade(color, 0.3),
background: alpha(color, 0.3),
},

"&.Mui-disabled": {
background: fade(color, 0.15),
color: fade(color, 0.5),
background: alpha(color, 0.15),
color: alpha(color, 0.5),
},
}
},
Expand Down Expand Up @@ -214,15 +214,15 @@ const useButtonStyles = makeStyles((theme) => ({
},
"&.Mui-disabled": {
backgroundColor: theme.palette.action.disabledBackground,
color: fade(theme.palette.text.disabled, 0.5),
color: alpha(theme.palette.text.disabled, 0.5),
},
},

"&.MuiButton-outlined": {
color: theme.palette.error.main,
borderColor: theme.palette.error.main,
"&:hover": {
backgroundColor: fade(theme.palette.error.main, theme.palette.action.hoverOpacity),
backgroundColor: alpha(theme.palette.error.main, theme.palette.action.hoverOpacity),
"@media (hover: none)": {
backgroundColor: "transparent",
},
Expand All @@ -231,21 +231,21 @@ const useButtonStyles = makeStyles((theme) => ({
},
},
"&.Mui-disabled": {
color: fade(theme.palette.text.disabled, 0.5),
color: alpha(theme.palette.text.disabled, 0.5),
borderColor: theme.palette.action.disabled,
},
},

"&.MuiButton-text": {
color: theme.palette.error.main,
"&:hover": {
backgroundColor: fade(theme.palette.error.main, theme.palette.action.hoverOpacity),
backgroundColor: alpha(theme.palette.error.main, theme.palette.action.hoverOpacity),
"@media (hover: none)": {
backgroundColor: "transparent",
},
},
"&.Mui-disabled": {
color: fade(theme.palette.text.disabled, 0.5),
color: alpha(theme.palette.text.disabled, 0.5),
},
},
},
Expand All @@ -264,15 +264,15 @@ const useButtonStyles = makeStyles((theme) => ({
},
"&.Mui-disabled": {
backgroundColor: theme.palette.action.disabledBackground,
color: fade(theme.palette.text.disabled, 0.5),
color: alpha(theme.palette.text.disabled, 0.5),
},
},

"&.MuiButton-outlined": {
color: theme.palette.success.main,
borderColor: theme.palette.success.main,
"&:hover": {
backgroundColor: fade(theme.palette.success.main, theme.palette.action.hoverOpacity),
backgroundColor: alpha(theme.palette.success.main, theme.palette.action.hoverOpacity),
"@media (hover: none)": {
backgroundColor: "transparent",
},
Expand All @@ -281,21 +281,21 @@ const useButtonStyles = makeStyles((theme) => ({
},
},
"&.Mui-disabled": {
color: fade(theme.palette.text.disabled, 0.5),
color: alpha(theme.palette.text.disabled, 0.5),
borderColor: theme.palette.action.disabled,
},
},

"&.MuiButton-text": {
color: theme.palette.success.main,
"&:hover": {
backgroundColor: fade(theme.palette.success.main, theme.palette.action.hoverOpacity),
backgroundColor: alpha(theme.palette.success.main, theme.palette.action.hoverOpacity),
"@media (hover: none)": {
backgroundColor: "transparent",
},
},
"&.Mui-disabled": {
color: fade(theme.palette.text.disabled, 0.5),
color: alpha(theme.palette.text.disabled, 0.5),
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions site/src/components/TabPanel/TabPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { makeStyles } from "@material-ui/core/styles"
import { fade } from "@material-ui/core/styles/colorManipulator"
import { alpha } from "@material-ui/core/styles/colorManipulator"
import { FC } from "react"
import { TabSidebar, TabSidebarItem } from "../TabSidebar/TabSidebar"

Expand Down Expand Up @@ -53,7 +53,7 @@ const useStyles = makeStyles((theme) => ({
position: "absolute",
left: -50,
top: 31,
color: fade(theme.palette.common.black, 0.1),
color: alpha(theme.palette.common.black, 0.1),
transition: "transform 0.3s ease",
zIndex: -1,
},
Expand Down