The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/client/components/Sidebar/Header.tsx

31 lines
911 B

import { Box, IconButton } from '@rocket.chat/fuselage';
import { useTranslation } from '@rocket.chat/ui-contexts';
import type { FC, ReactNode } from 'react';
import React from 'react';
type HeaderProps = {
title?: ReactNode;
onClose?: () => void;
};
const Header: FC<HeaderProps> = ({ title, onClose, children, ...props }) => {
const t = useTranslation();
return (
<Box is='header' display='flex' flexDirection='column' pb='x16' {...props}>
{(title || onClose) && (
<Box display='flex' flexDirection='row' alignItems='center' pi='x24' justifyContent='space-between' flexGrow={1}>
{title && (
<Box color='default' fontScale='p2' flexShrink={1} withTruncatedText>
{title}
</Box>
)}
{onClose && <IconButton aria-label={t('Close')} title={t('Close')} small icon='cross' onClick={onClose} />}
</Box>
)}
{children}
</Box>
);
};
export default Header;