Skip to content

Commit

Permalink
EPMRPP-97554 || Removed uid from System Alert (#60)
Browse files Browse the repository at this point in the history
* EPMRPP-97554 || Removed uid from System Alert

* EPMRPP-97554 || Removed uid from SystemAlertStories

* EPMRPP-97554 || crf - 1
  • Loading branch information
maria-hambardzumian authored Dec 23, 2024
1 parent a149e3e commit a45db17
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/components/systemAlert/systemAlert.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const meta: Meta<typeof SystemAlert> = {
},
tags: ['autodocs'],
args: {
uid: '1',
title: 'Ab dignissimos exercitationem laudantium magni voluptas.',
onClose: () => {},
type: SystemAlertType.SUCCESS,
Expand Down
11 changes: 3 additions & 8 deletions src/components/systemAlert/systemAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const ERROR_DURATION = 7000;
const DEFAULT_DURATION = 4000;

export const SystemAlert: FC<SystemAlertProps> = ({
uid,
title,
onClose,
icon = null,
Expand All @@ -21,11 +20,11 @@ export const SystemAlert: FC<SystemAlertProps> = ({

useEffect(() => {
const timer = setTimeout(() => {
onClose(uid);
onClose();
}, adjustedDuration);

return () => clearTimeout(timer);
}, [adjustedDuration, uid, onClose]);
}, [adjustedDuration, onClose]);

const getIcon = (): ReactElement | null => {
switch (type) {
Expand All @@ -45,11 +44,7 @@ export const SystemAlert: FC<SystemAlertProps> = ({
<div className={cx('content-wrapper')}>
<h2 className={cx('title')}>{title}</h2>
</div>
<button
className={cx('close-button')}
onClick={() => onClose(uid)}
aria-label="close system alert"
>
<button className={cx('close-button')} onClick={onClose} aria-label="close system alert">
<CloseIcon />
</button>
</div>
Expand Down
3 changes: 1 addition & 2 deletions src/components/systemAlert/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ export enum SystemAlertType {
ERROR = 'error',
}
export interface SystemAlertProps {
uid: string | number;
title: string;
onClose: (id: string | number) => void;
onClose: () => void;
icon?: ReactElement | null;
type?: SystemAlertType;
duration?: number;
Expand Down

0 comments on commit a45db17

Please sign in to comment.