import { Show, type JSX, type Component } from 'solid-js'; import ArrowLeft from 'heroicons/24/outline/arrow-left.svg'; import TimelineContentDisplay from '@/components/timeline/TimelineContentDisplay'; import { TimelineContext, useTimelineState } from '@/components/timeline/TimelineContext'; import { useHandleCommand } from '@/hooks/useCommandBus'; import { useTranslation } from '@/i18n/useTranslation'; export type ColumnProps = { timelineRef?: (el: HTMLDivElement) => void; columnIndex: number; lastColumn: boolean; width: 'widest' | 'wide' | 'medium' | 'narrow' | null | undefined; header: JSX.Element; children: JSX.Element; }; const Column: Component = (props) => { let columnDivRef: HTMLDivElement | undefined; const timelineState = useTimelineState(); const i18n = useTranslation(); const width = () => props.width ?? 'medium'; useHandleCommand(() => ({ commandType: 'moveToColumn', handler: (command) => { if (command.command === 'moveToColumn' && command.columnIndex === props.columnIndex) { columnDivRef?.scrollIntoView({ behavior: 'smooth', inline: 'center' }); } }, })); useHandleCommand(() => ({ commandType: 'moveToLastColumn', handler: () => { if (props.lastColumn) { columnDivRef?.scrollIntoView({ behavior: 'smooth' }); } }, })); return (
{props.header}
{props.children}
} > {(timeline) => ( <>
)}
); }; export default Column;