import React from 'react' import cc from 'classcat' import { A11yProps, pickA11yProps } from '../_utils/interfaces' import { Avatar } from '../avatar' import { TextDisplayType } from '../text' import { TextBody } from '../typography/body' import { StyledProfile } from './Profile.style' import { Rating } from './rating' export type ProfileProps = A11yProps & Readonly<{ className?: string mainTitle: string info?: string | JSX.Element isLink?: boolean picture?: string alt?: string isIdChecked?: boolean isMedium?: boolean score?: number ratings?: number ratingsLabel?: string href?: string | JSX.Element onClick?: (event: React.MouseEvent) => void onBlur?: (event: React.FocusEventHandler) => void onFocus?: (event: React.FocusEventHandler) => void onMouseDown?: (event: React.MouseEvent) => void }> export const Profile = (props: ProfileProps) => { const { className, mainTitle, info, picture, alt, isIdChecked, isMedium, isLink, score, ratings, ratingsLabel, href, onClick, onBlur, onFocus, onMouseDown, } = props const a11yAttrs = pickA11yProps(props) const showChevron = isLink || !!href || !!onClick const getLeftBody = ratings > 0 ? ( {ratingsLabel} ) : ( info && {info} ) return ( ) } chevron={showChevron} href={href} onClick={onClick} onBlur={onBlur} onFocus={onFocus} onMouseDown={onMouseDown} isClickable={showChevron} hasClickableColorRules {...a11yAttrs} /> ) }