diff --git a/packages/core/package.json b/packages/core/package.json
index 3175ae9b..53b65512 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -80,6 +80,7 @@
"@styled-icons/fluentui-system-regular": "10.47.0",
"@styled-icons/heroicons-outline": "10.47.0",
"@styled-icons/material": "10.47.0",
+ "@styled-icons/material-outlined": "10.47.0",
"@styled-icons/material-rounded": "10.47.0",
"@styled-icons/remix-editor": "10.46.0",
"@styled-icons/simple-icons": "10.46.0",
diff --git a/packages/core/src/components/common/alert/Alert.tsx b/packages/core/src/components/common/alert/Alert.tsx
index 628a8d7d..22d56140 100644
--- a/packages/core/src/components/common/alert/Alert.tsx
+++ b/packages/core/src/components/common/alert/Alert.tsx
@@ -1,14 +1,10 @@
-import Button from '@mui/material/Button';
-import Dialog from '@mui/material/Dialog';
-import DialogActions from '@mui/material/DialogActions';
-import DialogContent from '@mui/material/DialogContent';
-import DialogContentText from '@mui/material/DialogContentText';
-import DialogTitle from '@mui/material/DialogTitle';
import React, { useCallback, useMemo, useState } from 'react';
import { translate } from 'react-polyglot';
import AlertEvent from '@staticcms/core/lib/util/events/AlertEvent';
import { useWindowEvent } from '@staticcms/core/lib/util/window.util';
+import Button from '../button/Button';
+import Modal from '../modal/Modal';
import type { TranslateProps } from 'react-polyglot';
@@ -68,24 +64,51 @@ const AlertDialog = ({ t }: TranslateProps) => {
}
return (
-
-
+
+ {body}
+
+
+
+
+
);
};
diff --git a/packages/core/src/components/common/confirm/Confirm.tsx b/packages/core/src/components/common/confirm/Confirm.tsx
index 5cec8bfd..85fa9770 100644
--- a/packages/core/src/components/common/confirm/Confirm.tsx
+++ b/packages/core/src/components/common/confirm/Confirm.tsx
@@ -84,8 +84,9 @@ const ConfirmDialog = ({ t }: TranslateProps) => {
open
onClose={handleCancel}
className="
- w-[540px]
-
+ w-[50%]
+ min-w-[300px]
+ max-w-[600px]
"
aria-labelledby="confirm-dialog-title"
aria-describedby="confirm-dialog-description"
diff --git a/packages/core/src/components/snackbar/SnackbarAlert.tsx b/packages/core/src/components/snackbar/SnackbarAlert.tsx
new file mode 100644
index 00000000..e8827586
--- /dev/null
+++ b/packages/core/src/components/snackbar/SnackbarAlert.tsx
@@ -0,0 +1,137 @@
+import { Info as InfoIcon } from '@styled-icons/material-outlined/Info';
+import { Close as CloseIcon } from '@styled-icons/material/Close';
+import { ErrorOutline as ErrorOutlineIcon } from '@styled-icons/material/ErrorOutline';
+import { TaskAlt as TaskAltIcon } from '@styled-icons/material/TaskAlt';
+import { WarningAmber as WarningAmberIcon } from '@styled-icons/material/WarningAmber';
+import React, { forwardRef, useMemo } from 'react';
+
+import classNames from '@staticcms/core/lib/util/classNames.util';
+import IconButton from '../common/button/IconButton';
+
+import type { TranslatedProps } from '@staticcms/core/interface';
+import type { SnackbarMessage } from '@staticcms/core/store/slices/snackbars';
+
+interface SnackbarAlertProps {
+ data: SnackbarMessage;
+ onClose: () => void;
+}
+
+const SnackbarAlert = forwardRef>(
+ ({ data, onClose, t }, ref) => {
+ const { type, message } = data;
+
+ const renderedMessage = useMemo(() => {
+ if (typeof message === 'string') {
+ return message;
+ }
+
+ const { key, options } = message;
+ return t(key, options);
+ }, [message, t]);
+
+ const icon = useMemo(() => {
+ switch (type) {
+ case 'error':
+ return ;
+ case 'success':
+ return ;
+ case 'warning':
+ return ;
+ default:
+ return ;
+ }
+ }, [type]);
+
+ return (
+
+
+ {icon}
+
+
+ {renderedMessage}
+
+
+ Close
+
+
+
+ );
+ },
+);
+
+SnackbarAlert.displayName = 'SnackbarAlert';
+
+export default SnackbarAlert;
diff --git a/packages/core/src/components/snackbar/Snackbars.tsx b/packages/core/src/components/snackbar/Snackbars.tsx
index b0836473..71ff5bee 100644
--- a/packages/core/src/components/snackbar/Snackbars.tsx
+++ b/packages/core/src/components/snackbar/Snackbars.tsx
@@ -1,21 +1,16 @@
-import { Close as CloseIcon } from '@styled-icons/material/Close';
-import Alert from '@mui/material/Alert';
-import IconButton from '@mui/material/IconButton';
import Snackbar from '@mui/material/Snackbar';
import React, { useCallback, useEffect, useState } from 'react';
import { translate } from 'react-polyglot';
import { useAppDispatch, useAppSelector } from '@staticcms/core/store/hooks';
import { removeSnackbarById, selectSnackbars } from '@staticcms/core/store/slices/snackbars';
+import SnackbarAlert from './SnackbarAlert';
-import type { TranslatedProps } from '@staticcms/core/interface';
import type { SnackbarMessage } from '@staticcms/core/store/slices/snackbars';
-import type { SyntheticEvent } from 'react';
+import type { FC, SyntheticEvent } from 'react';
+import type { TranslateProps } from 'react-polyglot';
-// eslint-disable-next-line @typescript-eslint/no-empty-interface
-interface SnackbarsProps {}
-
-const Snackbars = ({ t }: TranslatedProps) => {
+const Snackbars: FC = ({ t }) => {
const [open, setOpen] = useState(false);
const [messageInfo, setMessageInfo] = useState(undefined);
@@ -47,42 +42,17 @@ const Snackbars = ({ t }: TranslatedProps) => {
setMessageInfo(undefined);
};
- const renderAlert = useCallback(
- (data: SnackbarMessage) => {
- const { type, message } = data;
-
- let renderedMessage: string;
- if (typeof message === 'string') {
- renderedMessage = message;
- } else {
- const { key, options } = message;
- renderedMessage = t(key, options);
- }
-
- return (
-
- {renderedMessage}
-
- );
- },
- [handleClose, t],
- );
-
return (
-
-
- }
+ className="test"
>
- {messageInfo ? renderAlert(messageInfo) : undefined}
+ {messageInfo ? : undefined}
);
};
diff --git a/packages/core/src/styles/main.css b/packages/core/src/styles/main.css
index 3f5a0652..056e0ac7 100644
--- a/packages/core/src/styles/main.css
+++ b/packages/core/src/styles/main.css
@@ -170,8 +170,8 @@
.btn-contained-success {
@apply border
border-transparent
- bg-green-700
- hover:bg-green-800
+ bg-green-600
+ hover:bg-green-700
text-white
disabled:text-gray-50
disabled:bg-gray-300/80
@@ -219,8 +219,8 @@
.btn-contained-error {
@apply border
border-transparent
- bg-red-700
- hover:bg-red-800
+ bg-red-600
+ hover:bg-red-700
text-white
disabled:text-gray-50
disabled:bg-gray-300/80
diff --git a/yarn.lock b/yarn.lock
index 50b34980..ff46e8f1 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3700,6 +3700,14 @@
"@babel/runtime" "^7.20.7"
"@styled-icons/styled-icon" "^10.7.0"
+"@styled-icons/material-outlined@10.47.0":
+ version "10.47.0"
+ resolved "https://registry.yarnpkg.com/@styled-icons/material-outlined/-/material-outlined-10.47.0.tgz#d799a14c1cbbd4d730d046d9f791f108e907fd34"
+ integrity sha512-/QeDSGXlfRoIsgx4g4Hb//xhsucD4mJJsNPk/e1XzckxkNG+YHCIjbAHzDwxwNfSCJYcTDcOp2SZcoS7iyNGlw==
+ dependencies:
+ "@babel/runtime" "^7.20.7"
+ "@styled-icons/styled-icon" "^10.7.0"
+
"@styled-icons/material-rounded@10.47.0":
version "10.47.0"
resolved "https://registry.yarnpkg.com/@styled-icons/material-rounded/-/material-rounded-10.47.0.tgz#c2a9e8277ba88949caffe08d42360d7aa45afaa8"