import { ComponentType, getElementBounds } from '../../jsx'; import { Illus, ItemDesc, ItemLabel } from '../components'; import { FlexLayout } from '../layouts'; import { getItemProps } from '../utils'; import { registerItem } from './registry'; import type { BaseItemProps } from './types'; export interface SimpleIllusItemProps extends BaseItemProps { width?: number; illusSize?: number; gap?: number; usePaletteColor?: boolean; } export const SimpleIllusItem: ComponentType = (props) => { const [ { indexes, datum, width = 180, illusSize = width, gap = 8, themeColors, usePaletteColor = false, }, restProps, ] = getItemProps(props, ['width', 'illusSize', 'gap', 'usePaletteColor']); const { label, desc } = datum; const labelColor = usePaletteColor ? themeColors.colorPrimary : themeColors.colorText; const labelContent = ( {label} ); const labelBounds = getElementBounds(labelContent); return ( {labelContent} {desc} ); }; registerItem('simple-illus', { component: SimpleIllusItem, composites: ['illus', 'label', 'desc'], });