@ozen-ui/kit
Version:
React component library
22 lines (21 loc) • 1.28 kB
JavaScript
import { __assign, __rest } from "tslib";
import React, { forwardRef } from 'react';
import { useThemeProps } from '../../../../hooks/useThemeProps';
import { cn } from '../../../../utils/classname';
import { Avatar } from '../../../Avatar';
import { useListCardItemContext } from '../../ListCardItemContext';
import { ListCardItemLeadingItem } from '../ListCardItemLeadingItem';
import { LIST_CARD_ITEM_SIZE_TO_LEADING_AVATAR_SIZE } from './constants';
export var cnListCardItemLeadingAvatar = cn('ListCardItemLeadingAvatar');
export var ListCardItemLeadingAvatar = forwardRef(function (inProps, ref) {
var props = useThemeProps({
props: inProps,
name: 'ListCardItemLeadingAvatar',
});
var classNameProp = props.className, dataTestid = props["data-testid"], other = __rest(props, ["className", 'data-testid']);
var size = useListCardItemContext().size;
var avatarSize = LIST_CARD_ITEM_SIZE_TO_LEADING_AVATAR_SIZE[size];
return (React.createElement(ListCardItemLeadingItem, { ref: ref, className: cnListCardItemLeadingAvatar('', [classNameProp]), "data-testid": dataTestid },
React.createElement(Avatar, __assign({}, other, { ref: ref, size: avatarSize }))));
});
ListCardItemLeadingAvatar.displayName = 'ListCardItemLeadingAvatar';