File size: 989 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 |
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
import { Toolbar, Button } from '@material-ui/core';
import React from 'react';
import { useCallback } from 'react';
import styled from 'styled-components';
import { History } from 'history';
const Container = styled(Toolbar)`
display: flex;
background-color: var(--primary-bg);
color: var(--primary-text);
font-size: 20px;
line-height: 40px;
`;
const BackButton = styled(Button)`
svg {
color: var(--primary-text);
}
`;
const Title = styled.div`
flex: 1;
`;
interface ChildComponentProps {
history: History;
}
const ChatCreationNavbar: React.FC<ChildComponentProps> = ({ history }) => {
const navBack = useCallback(() => {
history.replace('/chats');
}, [history]);
return (
<Container>
<BackButton data-testid="back-button" onClick={navBack}>
<ArrowBackIcon />
</BackButton>
<Title>Create Chat</Title>
</Container>
);
};
export default ChatCreationNavbar;
|