File size: 1,014 Bytes
f5071ca |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
import Button from '@material-ui/core/Button';
import ChatIcon from '@material-ui/icons/Chat';
import React from 'react';
import styled from 'styled-components';
import { History } from 'history';
import { useUsersPrefetch } from '../UsersList';
const Container = styled.div`
position: fixed;
right: 10px;
bottom: 10px;
button {
min-width: 50px;
width: 50px;
height: 50px;
border-radius: 999px;
background-color: var(--secondary-bg);
color: white;
}
`;
interface ChildComponentProps {
history: History;
}
const AddChatButton: React.FC<ChildComponentProps> = ({ history }) => {
const prefetchUsers = useUsersPrefetch();
const onClick = () => {
history.push('/new-chat');
};
return (
<Container onMouseEnter={() => prefetchUsers()}>
<Button
data-testid="new-chat-button"
variant="contained"
color="secondary"
onClick={onClick}>
<ChatIcon />
</Button>
</Container>
);
};
export default AddChatButton;
|