update notification component

This commit is contained in:
Abhinav 2022-11-02 11:37:40 +05:30
parent d445153679
commit 8444ffe49e
4 changed files with 12 additions and 7 deletions

View file

@ -1,5 +1,6 @@
import CloseIcon from '@mui/icons-material/Close';
import {
Box,
Button,
ButtonProps,
IconButton,
@ -30,7 +31,7 @@ export default function Notification({ open, onClose, attributes }: Iprops) {
};
const handleClick = () => {
attributes?.onClick();
attributes.onClick();
onClose();
};
return (
@ -55,7 +56,9 @@ export default function Notification({ open, onClose, attributes }: Iprops) {
spacing={2}
direction="row"
alignItems={'center'}>
{attributes?.startIcon ?? <InfoIcon />}
<Box sx={{ svg: { fontSize: '36px' } }}>
{attributes.startIcon ?? <InfoIcon />}
</Box>
<Stack
direction={'column'}
@ -74,8 +77,10 @@ export default function Notification({ open, onClose, attributes }: Iprops) {
)}
</Stack>
{attributes?.endIcon ? (
<IconButton onClick={attributes.onClick}>
{attributes.endIcon ? (
<IconButton
onClick={attributes.onClick}
sx={{ fontSize: '36px' }}>
{attributes?.endIcon}
</IconButton>
) : (

View file

@ -463,13 +463,14 @@ export default function Uploader(props: Props) {
subtext: constants.STORAGE_QUOTA_EXCEEDED,
message: constants.UPGRADE_NOW,
onClick: () => galleryContext.showPlanSelectorModal(),
startIcon: <DiscFullIcon fontSize="large" />,
startIcon: <DiscFullIcon />,
};
break;
default:
notification = {
variant: 'danger',
message: constants.UNKNOWN_ERROR,
onClick: () => null,
};
}
appContext.setNotificationAttributes(notification);

View file

@ -666,7 +666,6 @@ export default function Gallery() {
sidebarView={sidebarView}
closeSidebar={closeSidebar}
/>
<PhotoFrame
files={files}
syncWithRemote={syncWithRemote}

View file

@ -6,7 +6,7 @@ export interface NotificationAttributes {
variant: ButtonProps['color'];
message: JSX.Element | string;
subtext?: JSX.Element | string;
onClick?: () => void;
onClick: () => void;
endIcon?: ReactNode;
}