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

update snackbar #65

Closed
wants to merge 3 commits into from
Closed
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,431 changes: 896 additions & 535 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
"dependencies": {
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@ethereum-attestation-service/eas-sdk": "^2.5.0",
"@ethereum-attestation-service/eas-sdk": "^2.2.0",
"@fontsource/inter": "^5.0.19",
"@fontsource/roboto": "^5.0.13",
"@lit-protocol/lit-node-client": "^6.4.0",
"@lit-protocol/types": "^6.4.0",
"@lit-protocol/lit-node-client": "^5.1.0",
"@lit-protocol/types": "^2.2.39",
"@mui/icons-material": "^5.16.0",
"@mui/material": "^5.16.0",
"@rainbow-me/rainbowkit": "^2.1.3",
Expand Down
22 changes: 17 additions & 5 deletions src/components/shared/CustomSnackbar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Snackbar, Alert } from '@mui/material';

import { Snackbar, Alert, AlertTitle, Link, Box } from '@mui/material';
import useSnackbarStore from '../../store/useSnackbarStore';

/**
Expand All @@ -16,18 +15,31 @@ export const CustomSnackbar = (): JSX.Element => {
anchorOrigin={
options?.position || { vertical: 'bottom', horizontal: 'right' }
}
autoHideDuration={options?.duration}
autoHideDuration={options?.duration ?? 3000}
open={open}
onClose={closeSnackbar}
>
<Alert
severity={options?.severity || 'info'}
sx={{ width: '100%' }}
sx={{ width: '100%', display: 'flex', alignItems: 'center' }}
variant="filled"
onClose={closeSnackbar}
icon={options?.icon}
aria-live="assertive"
>
{message}
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
<Box>
<AlertTitle>{message}</AlertTitle>
{options?.linkText && options?.linkUrl && (
<Link href={options.linkUrl} color="inherit" underline="always">
{options.linkText}
</Link>
)}
</Box>
</Box>
</Alert>
</Snackbar>
);
};

export default CustomSnackbar;
8 changes: 0 additions & 8 deletions src/pages/Dashboard/Dashboard.spec.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions src/pages/Dashboard/Dashboard.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions src/pages/Dashboard/index.ts

This file was deleted.

65 changes: 0 additions & 65 deletions src/router/index.tsx

This file was deleted.

3 changes: 3 additions & 0 deletions src/store/useSnackbarStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ interface SnackbarOptions {
severity?: 'success' | 'error' | 'warning' | 'info';
duration?: number;
position?: SnackbarOrigin;
icon?: React.ReactNode;
linkText?: string;
linkUrl?: string;
}

const useSnackbarStore = create<SnackbarState>((set) => ({
Expand Down
Loading