import { Loader } from '@mantine/core'; import type { ReactNode } from 'react'; import styles from '../../styles/griddy.module.css'; interface TreeExpandButtonProps { canExpand: boolean; isExpanded: boolean; isLoading?: boolean; onToggle: () => void; icons?: { collapsed?: ReactNode; expanded?: ReactNode; leaf?: ReactNode; }; } const DEFAULT_ICONS = { collapsed: '\u25B6', // ► expanded: '\u25BC', // ▼ leaf: null, }; export function TreeExpandButton({ canExpand, isExpanded, isLoading = false, onToggle, icons = DEFAULT_ICONS, }: TreeExpandButtonProps) { const displayIcons = { ...DEFAULT_ICONS, ...icons }; // If loading, show spinner if (isLoading) { return ( ); } // If can't expand (leaf node), show leaf icon or empty space if (!canExpand) { return ( {displayIcons.leaf || } ); } // Show expand/collapse icon return ( ); }