import { ComponentType, Group, Path, Polygon } from '../../jsx'; import { ItemDesc, ItemIcon, ItemLabel } from '../components'; import { getItemProps } from '../utils'; import { registerItem } from './registry'; import type { BaseItemProps } from './types'; export interface LCornerCardProps extends BaseItemProps { width?: number; iconSize?: number; } export const LCornerCard: ComponentType = (props) => { const [ { indexes, datum, width = 140, iconSize = 24, themeColors }, restProps, ] = getItemProps(props, ['width', 'iconSize']); const { label, desc } = datum; const lStroke = 8; const arrowSize = 16; const arrowGap = 12; const descX = arrowSize + arrowGap; const descWidth = width - descX; const descHeight = 60; const verticalLen = iconSize + 44; const arrowX1 = arrowSize; const arrowY1 = descHeight + arrowGap; const arrowY2 = descHeight + arrowSize + arrowGap; const arrowVertices = [ { x: 0, y: arrowY2 }, { x: arrowX1, y: arrowY1 }, { x: arrowX1, y: arrowY2 }, ]; const innerWidth = width - arrowX1 - arrowGap; const lx1 = arrowX1 + arrowGap; const lx2 = lx1 + innerWidth; const ly1 = arrowY1 + lStroke / 2; const ly2 = ly1 + verticalLen; const d = `M ${lx1} ${ly2} L ${lx1} ${ly1} L ${lx2} ${ly1}`; const halfStroke = lStroke / 2; const x1 = lx1 + halfStroke; const y1 = ly1 + halfStroke; const gap = 8; return ( {desc} {label} ); }; registerItem('l-corner-card', { component: LCornerCard, composites: ['icon', 'label', 'desc'], });