MCPcopy Index your code
hub / github.com/tinyplex/tinybase / Header

Function Header

src/ui-react-inspector/Header.tsx:14–43  ·  view source on GitHub ↗
({s}: StoreProp)

Source from the content-addressed store, hash-verified

12import {useSetValueCallback, useValue} from '../ui-react/index.ts';
13
14export 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};

Callers

nothing calls this directly

Calls 4

useValueFunction · 0.90
useSetValueCallbackFunction · 0.90
numberFunction · 0.90
arrayMapFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…