({s}: StoreProp)
| 12 | import {useSetValueCallback, useValue} from '../ui-react/index.ts'; |
| 13 | |
| 14 | export const Header = ({s}: StoreProp) => { |
| 15 | const position = useValue(POSITION_VALUE, s) ?? 1; |
| 16 | const handleClick = () => open('https://tinybase.org', '_blank'); |
| 17 | const handleClose = useSetValueCallback(OPEN_VALUE, () => false, [], s); |
| 18 | const handleDock = useSetValueCallback( |
| 19 | POSITION_VALUE, |
| 20 | (event: MouseEvent<HTMLImageElement>) => |
| 21 | number(event[CURRENT_TARGET].dataset.id), |
| 22 | [], |
| 23 | s, |
| 24 | ); |
| 25 | |
| 26 | return ( |
| 27 | <header> |
| 28 | <img className="flat" title={TITLE} onClick={handleClick} /> |
| 29 | <span>{TITLE}</span> |
| 30 | {arrayMap(POSITIONS, (name, p) => |
| 31 | p == position ? null : ( |
| 32 | <img |
| 33 | onClick={handleDock} |
| 34 | data-id={p} |
| 35 | title={'Dock to ' + name} |
| 36 | key={p} |
| 37 | /> |
| 38 | ), |
| 39 | )} |
| 40 | <img className="flat" onClick={handleClose} title="Close" /> |
| 41 | </header> |
| 42 | ); |
| 43 | }; |
nothing calls this directly
no test coverage detected
searching dependent graphs…