2019-12-07 00:09:01 +07:00
|
|
|
import React, { memo } from 'react';
|
|
|
|
import styled from '@emotion/styled';
|
|
|
|
import Error from '@material-ui/icons/Error';
|
|
|
|
|
|
|
|
import SnackbarContent from '../../muiComponents/SnackbarContent';
|
|
|
|
import Box from '../../muiComponents/Box';
|
|
|
|
import { Theme } from '../../design-tokens/theme';
|
|
|
|
import { LoginError } from '../../utils/login';
|
|
|
|
|
|
|
|
const StyledSnackbarContent = styled(SnackbarContent)<{ theme?: Theme }>(({ theme }) => ({
|
2020-03-31 13:44:59 +07:00
|
|
|
backgroundColor: theme?.palette.error.dark,
|
|
|
|
color: theme?.palette.white,
|
2019-12-07 00:09:01 +07:00
|
|
|
}));
|
|
|
|
|
|
|
|
const StyledErrorIcon = styled(Error)<{ theme?: Theme }>(({ theme }) => ({
|
|
|
|
fontSize: 20,
|
|
|
|
opacity: 0.9,
|
2020-03-31 13:44:59 +07:00
|
|
|
marginRight: theme?.spacing(1),
|
2019-12-07 00:09:01 +07:00
|
|
|
}));
|
|
|
|
|
|
|
|
export interface FormValues {
|
|
|
|
username: string;
|
|
|
|
password: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
error: LoginError;
|
|
|
|
}
|
|
|
|
|
|
|
|
const LoginDialogFormError = memo(({ error }: Props) => {
|
|
|
|
return (
|
|
|
|
<StyledSnackbarContent
|
|
|
|
message={
|
|
|
|
<Box alignItems="center" display="flex">
|
|
|
|
<StyledErrorIcon />
|
|
|
|
{error.description}
|
|
|
|
</Box>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
export default LoginDialogFormError;
|