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/client/components/Card/CardIcon.tsx

14 lines
590 B

import { Box, Icon } from '@rocket.chat/fuselage';
import React, { ComponentProps, ReactElement, ReactNode } from 'react';
type CardIconProps = { children: ReactNode } | ComponentProps<typeof Icon>;
const hasChildrenProp = (props: CardIconProps): props is { children: ReactNode } => 'children' in props;
const CardIcon = (props: CardIconProps): ReactElement => (
<Box minWidth='x16' display='inline-flex' flexDirection='row' alignItems='flex-end' justifyContent='center'>
{hasChildrenProp(props) ? props.children : <Icon size='x16' {...props} />}
</Box>
);
export default CardIcon;