Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPMRPP-97554 || Removed uid from System Alert #60

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
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
Loading