|
|
|
@ -1,21 +1,21 @@ |
|
|
|
|
import styled from 'styled-components' |
|
|
|
|
import { useSelector, useDispatch } from 'react-redux' |
|
|
|
|
import styled from "styled-components"; |
|
|
|
|
import { useSelector, useDispatch } from "react-redux"; |
|
|
|
|
// components
|
|
|
|
|
import Snackbar from 'components/commons/Snackbar' |
|
|
|
|
import Snackbar from "components/commons/Snackbar"; |
|
|
|
|
// lib
|
|
|
|
|
import zIndex from 'lib/styles/zIndex' |
|
|
|
|
import media from 'lib/styles/media' |
|
|
|
|
import zIndex from "lib/styles/zIndex"; |
|
|
|
|
import media from "lib/styles/media"; |
|
|
|
|
// slices
|
|
|
|
|
import { deleteSnackbar } from 'slices/snackbar' |
|
|
|
|
import { deleteSnackbar } from "slices/snackbar"; |
|
|
|
|
// types
|
|
|
|
|
import { RootState } from 'slices' |
|
|
|
|
import { SnackbarState } from 'slices/snackbar' |
|
|
|
|
import { RootState } from "slices"; |
|
|
|
|
import { SnackbarState } from "slices/snackbar"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const SnackbarWrapper = ()=> { |
|
|
|
|
const SnackbarWrapper = () => { |
|
|
|
|
const dispatch = useDispatch(); |
|
|
|
|
const snackbar = useSelector<RootState, SnackbarState>(state => state.snackbar); |
|
|
|
|
|
|
|
|
|
const snackbar = useSelector<RootState, SnackbarState>( |
|
|
|
|
(state) => state.snackbar |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
const onClick = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => { |
|
|
|
|
if (e) { |
|
|
|
@ -25,15 +25,14 @@ const SnackbarWrapper = ()=> { |
|
|
|
|
dispatch(deleteSnackbar()); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<Container> |
|
|
|
|
{snackbar.text !== '' && <Snackbar onClick={onClick}
|
|
|
|
|
text={snackbar.text}
|
|
|
|
|
type={snackbar.type} />} |
|
|
|
|
{snackbar.text !== "" && ( |
|
|
|
|
<Snackbar onClick={onClick} text={snackbar.text} type={snackbar.type} /> |
|
|
|
|
)} |
|
|
|
|
</Container> |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const Container = styled.div` |
|
|
|
|
position: fixed; |
|
|
|
@ -53,4 +52,4 @@ const Container = styled.div` |
|
|
|
|
} |
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
export default SnackbarWrapper |
|
|
|
|
export default SnackbarWrapper; |
|
|
|
|