import React, { ReactNode } from 'react' import Avatar from '../avatar' import useTheme from '../styles/use-theme' import UserLink from './user-link' interface Props { name: ReactNode | string src?: string text?: string className?: string altText?: string } const defaultProps = { className: '', } type NativeAttrs = Omit, keyof Props> export type UserProps = Props & typeof defaultProps & NativeAttrs const User: React.FC> = ({ src, text, name, children, className, altText, ...props }) => { const theme = useTheme() return (
{name} {children}
) } type MemoUserComponent

= React.NamedExoticComponent

& { Link: typeof UserLink } type ComponentProps = Partial & Omit & NativeAttrs User.defaultProps = defaultProps export default React.memo(User) as MemoUserComponent