import { useClassList } from "../utils/useProps"; import { useListContext, ListContextProps } from "."; type ListItemProps = { id: string | number, data?: any, style?: any, render?: Function, actions?: any, avatar?: any, content?: any, children?: any, title?: any, desc?: any, } // {className, style, data, actions, activeKey, render, onClick} export function Item (props: ListItemProps) { const ctx: ListContextProps|undefined = useListContext(); const activeKey = ctx?.signal[0]; const setActiveKey = ctx?.signal[1]; const classList = () => useClassList(props, 'cm-list-item', { 'cm-list-item-active': activeKey && activeKey() === props.id }); const onClick = () => { setActiveKey && setActiveKey(props.id); ctx?.onSelect && ctx.onSelect(props.data); } return