({ initialHeight }: { initialHeight: number })
| 4 | // Its height is state of its own (changed through window.setHeaderHeight), |
| 5 | // so that changing it does not re-render the virtualized component. |
| 6 | export function Header({ initialHeight }: { initialHeight: number }) { |
| 7 | const [height, setHeight] = useState(initialHeight); |
| 8 | |
| 9 | useEffect(() => { |
| 10 | window.setHeaderHeight = setHeight; |
| 11 | return () => { |
| 12 | window.setHeaderHeight = null; |
| 13 | }; |
| 14 | }, []); |
| 15 | |
| 16 | return ( |
| 17 | <div |
| 18 | data-test-id="header" |
| 19 | style={{ height, backgroundColor: "lightblue", flexShrink: 0 }} |
| 20 | > |
| 21 | Header |
| 22 | </div> |
| 23 | ); |
| 24 | } |
nothing calls this directly
no outgoing calls
no test coverage detected