@workday/canvas-kit-react
Version:
The parent module that contains all Workday Canvas Kit React components
20 lines (19 loc) • 1.12 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { createComponent } from '@workday/canvas-kit-react/common';
import { Avatar, avatarStencil } from '@workday/canvas-kit-preview-react/avatar';
import { createStencil } from '@workday/canvas-kit-styling';
import { mergeStyles } from '@workday/canvas-kit-react/layout';
export const expandableAvatarStencil = createStencil({
extends: avatarStencil,
base: { name: "l7kts", styles: "box-sizing:border-box;flex-shrink:0;" }
}, "expandable-avatar-4eeed1");
// When the component is created, it needs to be a button element to match AvatarProps.
// Once Avatar becomes a `createComponent` we can default the element type to a `div`
// and the types should be properly extracted
// Setting altText prop to a default empty string for decorative purposes
export const ExpandableAvatar = createComponent('div')({
displayName: 'Expandable.Avatar',
Component: ({ name = '', ...elemProps }, ref, Element) => {
return (_jsx(Avatar, { as: Element, name: name, ref: ref, size: "extraSmall", ...mergeStyles(elemProps, expandableAvatarStencil()) }));
},
});