mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: Update UI for error dialog and snackbar (#1971)
* feat: update ui for error dialog and snackbar * update padding for buttons
This commit is contained in:
@@ -48,11 +48,15 @@ interface StyleProps {
|
|||||||
const useStyles = makeStyles((theme) => ({
|
const useStyles = makeStyles((theme) => ({
|
||||||
dialogWrapper: (props: StyleProps) => ({
|
dialogWrapper: (props: StyleProps) => ({
|
||||||
"& .MuiPaper-root": {
|
"& .MuiPaper-root": {
|
||||||
background: props.type === "info" ? theme.palette.primary.main : theme.palette.error.dark,
|
background: props.type === "info" ? theme.palette.primary.main : theme.palette.background.paper,
|
||||||
|
border: `1px solid ${theme.palette.divider}`,
|
||||||
|
},
|
||||||
|
"& .MuiDialogActions-spacing": {
|
||||||
|
padding: `0 ${theme.spacing(3.75)}px ${theme.spacing(3.75)}px`,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
dialogContent: (props: StyleProps) => ({
|
dialogContent: (props: StyleProps) => ({
|
||||||
color: props.type === "info" ? theme.palette.primary.contrastText : theme.palette.error.contrastText,
|
color: props.type === "info" ? theme.palette.primary.contrastText : theme.palette.text.secondary,
|
||||||
padding: theme.spacing(6),
|
padding: theme.spacing(6),
|
||||||
textAlign: "center",
|
textAlign: "center",
|
||||||
}),
|
}),
|
||||||
@@ -61,16 +65,14 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
},
|
},
|
||||||
description: (props: StyleProps) => ({
|
description: (props: StyleProps) => ({
|
||||||
color:
|
color:
|
||||||
props.type === "info"
|
props.type === "info" ? fade(theme.palette.primary.contrastText, 0.75) : fade(theme.palette.text.secondary, 0.75),
|
||||||
? fade(theme.palette.primary.contrastText, 0.75)
|
|
||||||
: fade(theme.palette.error.contrastText, 0.75),
|
|
||||||
lineHeight: "160%",
|
lineHeight: "160%",
|
||||||
|
|
||||||
"& strong": {
|
"& strong": {
|
||||||
color:
|
color:
|
||||||
props.type === "info"
|
props.type === "info"
|
||||||
? fade(theme.palette.primary.contrastText, 0.95)
|
? fade(theme.palette.primary.contrastText, 0.95)
|
||||||
: fade(theme.palette.error.contrastText, 0.95),
|
: fade(theme.palette.text.secondary, 0.95),
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
}))
|
}))
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ export const DialogActionButtons: React.FC<DialogActionButtonsProps> = ({
|
|||||||
})}
|
})}
|
||||||
disabled={confirmLoading}
|
disabled={confirmLoading}
|
||||||
onClick={onCancel}
|
onClick={onCancel}
|
||||||
variant="contained"
|
variant="outlined"
|
||||||
>
|
>
|
||||||
{cancelText}
|
{cancelText}
|
||||||
</LoadingButton>
|
</LoadingButton>
|
||||||
@@ -145,10 +145,10 @@ interface StyleProps {
|
|||||||
|
|
||||||
const useButtonStyles = makeStyles((theme) => ({
|
const useButtonStyles = makeStyles((theme) => ({
|
||||||
dialogButton: {
|
dialogButton: {
|
||||||
borderRadius: 0,
|
borderRadius: theme.shape.borderRadius,
|
||||||
fontSize: theme.typography.h6.fontSize,
|
fontSize: theme.typography.h6.fontSize,
|
||||||
fontWeight: theme.typography.h5.fontWeight,
|
fontWeight: theme.typography.h5.fontWeight,
|
||||||
padding: theme.spacing(2.25),
|
padding: `${theme.spacing(0.75)}px ${theme.spacing(2)}px`,
|
||||||
width: "100%",
|
width: "100%",
|
||||||
boxShadow: "none",
|
boxShadow: "none",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -81,8 +81,9 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
color: theme.palette.error.contrastText,
|
color: theme.palette.error.contrastText,
|
||||||
},
|
},
|
||||||
snackbarContent: {
|
snackbarContent: {
|
||||||
|
border: `1px solid ${theme.palette.divider}`,
|
||||||
borderLeft: `4px solid ${theme.palette.primary.main}`,
|
borderLeft: `4px solid ${theme.palette.primary.main}`,
|
||||||
borderRadius: 0,
|
borderRadius: theme.shape.borderRadius,
|
||||||
padding: `${theme.spacing(1)}px ${theme.spacing(3)}px ${theme.spacing(1)}px ${theme.spacing(2)}px`,
|
padding: `${theme.spacing(1)}px ${theme.spacing(3)}px ${theme.spacing(1)}px ${theme.spacing(2)}px`,
|
||||||
boxShadow: theme.shadows[6],
|
boxShadow: theme.shadows[6],
|
||||||
alignItems: "inherit",
|
alignItems: "inherit",
|
||||||
@@ -94,8 +95,8 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
color: theme.palette.info.contrastText,
|
color: theme.palette.info.contrastText,
|
||||||
},
|
},
|
||||||
snackbarContentError: {
|
snackbarContentError: {
|
||||||
backgroundColor: theme.palette.error.dark,
|
backgroundColor: theme.palette.background.paper,
|
||||||
borderLeftColor: theme.palette.error.main,
|
borderLeftColor: theme.palette.error.main,
|
||||||
color: theme.palette.error.contrastText,
|
color: theme.palette.text.secondary,
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
|
|||||||
Reference in New Issue
Block a user