fix(general): enhancements and bug fixes (#4018)

This commit is contained in:
Ibrahim authored and GitHub committed 2024-04-10 11:34:13 -04:00
1 parent ac0e1c0a2c
commit 2b83393f91
30 files changed
+710 -151

No files matched your search

@@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
import Button, { ButtonEnums } from '../Button';
import Icon from '../Icon';
const Notification = ({ id, type, message, actions, onSubmit, onOutsideClick }) => {
const Notification = ({ id, type, message, actions, onSubmit, onOutsideClick, onKeyPress }) => {
const notificationRef = useRef(null);
useEffect(() => {
@@ -29,6 +29,10 @@ const Notification = ({ id, type, message, actions, onSubmit, onOutsideClick })
};
}, [onOutsideClick]);
useEffect(() => {
notificationRef.current.focus();
}, []);
const iconsByType = {
error: {
icon: 'info',
@@ -64,6 +68,8 @@ const Notification = ({ id, type, message, actions, onSubmit, onOutsideClick })
ref={notificationRef}
className="border-customblue-10 bg-customblue-400 mx-2 mt-2 flex flex-col rounded-md border-2 p-2"
data-cy={id}
onKeyDown={onKeyPress}
tabIndex={0}
>
<div className="flex grow items-center">
<Icon
@@ -112,6 +118,7 @@ Notification.propTypes = {
onSubmit: PropTypes.func.isRequired,
/** Can be used as a callback to dismiss the notification for clicks that occur outside of it */
onOutsideClick: PropTypes.func,
onKeyPress: PropTypes.func,
};
export default Notification;