(predicate: boolean)
| 1 | import { useEffect } from 'react'; |
| 2 | |
| 3 | export function useHideOnModal(predicate: boolean): void { |
| 4 | useEffect(() => { |
| 5 | const root = document.querySelector('#__next'); |
| 6 | if (!root) { |
| 7 | return undefined; |
| 8 | } |
| 9 | if (predicate) { |
| 10 | root.classList.add('hide-on-modal'); |
| 11 | } else { |
| 12 | root.classList.remove('hide-on-modal'); |
| 13 | } |
| 14 | |
| 15 | return () => { |
| 16 | root.classList.remove('hide-on-modal'); |
| 17 | }; |
| 18 | }, [predicate]); |
| 19 | } |
no outgoing calls
no test coverage detected