()
| 5 | import { DetailsPanel } from './DetailsPanel' |
| 6 | |
| 7 | export function Shell() { |
| 8 | const styles = useStyles() |
| 9 | const [leftPanelWidth, setLeftPanelWidth] = createSignal(300) |
| 10 | const [isDragging, setIsDragging] = createSignal(false) |
| 11 | |
| 12 | const [selectedKey, setSelectedKey] = createSignal<string | null>(null) |
| 13 | |
| 14 | let dragStartX = 0 |
| 15 | let dragStartWidth = 0 |
| 16 | |
| 17 | const handleMouseDown = (e: MouseEvent) => { |
| 18 | e.preventDefault() |
| 19 | e.stopPropagation() |
| 20 | setIsDragging(true) |
| 21 | document.body.style.cursor = 'col-resize' |
| 22 | document.body.style.userSelect = 'none' |
| 23 | dragStartX = e.clientX |
| 24 | dragStartWidth = leftPanelWidth() |
| 25 | } |
| 26 | |
| 27 | const handleMouseMove = (e: MouseEvent) => { |
| 28 | if (!isDragging()) return |
| 29 | |
| 30 | e.preventDefault() |
| 31 | const deltaX = e.clientX - dragStartX |
| 32 | const newWidth = Math.max(150, Math.min(800, dragStartWidth + deltaX)) |
| 33 | setLeftPanelWidth(newWidth) |
| 34 | } |
| 35 | |
| 36 | const handleMouseUp = () => { |
| 37 | setIsDragging(false) |
| 38 | document.body.style.cursor = '' |
| 39 | document.body.style.userSelect = '' |
| 40 | } |
| 41 | |
| 42 | onMount(() => { |
| 43 | document.addEventListener('mousemove', handleMouseMove) |
| 44 | document.addEventListener('mouseup', handleMouseUp) |
| 45 | }) |
| 46 | |
| 47 | onCleanup(() => { |
| 48 | document.removeEventListener('mousemove', handleMouseMove) |
| 49 | document.removeEventListener('mouseup', handleMouseUp) |
| 50 | }) |
| 51 | |
| 52 | return ( |
| 53 | <MainPanel> |
| 54 | <Header> |
| 55 | <HeaderLogo flavor={{ light: '#eeaf00', dark: '#eeaf00' }}> |
| 56 | TanStack Form |
| 57 | </HeaderLogo> |
| 58 | </Header> |
| 59 | |
| 60 | <div class={styles().mainContainer}> |
| 61 | <div |
| 62 | class={styles().leftPanel} |
| 63 | style={{ |
| 64 | width: `${leftPanelWidth()}px`, |
nothing calls this directly
no test coverage detected