diff --git a/phone/src/ui/components/SnackBar.tsx b/phone/src/ui/components/SnackBar.tsx deleted file mode 100644 index 4d23f16..0000000 --- a/phone/src/ui/components/SnackBar.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import React from 'react'; - -export const SnackBar = ({ children }) => { - return ( -
-

{children}

-
- ) -} \ No newline at end of file diff --git a/phone/src/ui/components/SnackbarProvider.tsx b/phone/src/ui/components/SnackbarProvider.tsx index 4df39a6..34d76b8 100644 --- a/phone/src/ui/components/SnackbarProvider.tsx +++ b/phone/src/ui/components/SnackbarProvider.tsx @@ -2,6 +2,7 @@ import React, { createContext, useState, useEffect, useMemo, useCallback } from import Alert from './Alert'; import { makeStyles } from '@material-ui/core/styles'; import { Snackbar } from '@material-ui/core'; +import { ISnackbar } from '../interface/InterfaceUI'; const useStyles = makeStyles(() => ({ alert: { @@ -28,7 +29,7 @@ function SnackbarProvider({ children }) { return () => clearTimeout(timer); }, [alertIdx]) - const addAlert = useCallback((content) => setAlerts((alerts) => [content, ...alerts]), []); + const addAlert = useCallback((message, type) => setAlerts((alerts) => [{message, type}, ...alerts]), []); const value = useMemo(() => ({ addAlert }), [addAlert]); @@ -36,10 +37,10 @@ function SnackbarProvider({ children }) { <> {children} - {alerts.map((alert) => ( + {alerts.map((alert: ISnackbar) => (
- - {alert} + + {alert.message}
))}