@workday/canvas-kit-react
Version:
The parent module that contains all Workday Canvas Kit React components
14 lines (13 loc) • 755 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { createComponent } from '@workday/canvas-kit-react/common';
import { createStencil, handleCsProp } from '@workday/canvas-kit-styling';
import { getInitialsFromName } from './getInitialsFromName';
export const avatarNameStencil = createStencil({
base: { name: "1ii5r", styles: "box-sizing:border-box;text-transform:uppercase;cursor:default;" }
}, "avatar-name-c3d5d9");
export const AvatarName = createComponent('span')({
displayName: 'AvatarName',
Component: ({ name, preferredInitials, ...elemProps }, ref, Element) => {
return (_jsx(Element, { ref: ref, ...handleCsProp(elemProps, avatarNameStencil()), children: preferredInitials || getInitialsFromName(name) }));
},
});