* Add dependencies for openapi-page component * Add openapi-page component * Use openapi-page component for /api-docs page * add /api link to nav (#570) * website: remove superflous netlify config file * website: misc clean up website/readme - remove netlify badge - run through prettier markdown fmt * website: add /api docs to nav - adds /api-docs => /api rewrite - updates open-api component base api path to be /api - adds .html rewrite for good measure * Fix currentPath highlight issue in subnav * Clean up inline styles in operation-object * Remove React imports * Remove api-docs rewrite Co-authored-by: Kyle MacDonald <kylemac@users.noreply.github.com>
30 lines
713 B
JavaScript
30 lines
713 B
JavaScript
import { useRef, useState, useEffect } from 'react'
|
|
|
|
function useHover() {
|
|
const [value, setValue] = useState(false)
|
|
|
|
const ref = useRef(null)
|
|
const handleMouseOver = () => setValue(true)
|
|
const handleMouseOut = () => setValue(false)
|
|
|
|
useEffect(
|
|
() => {
|
|
const node = ref.current
|
|
if (node) {
|
|
node.addEventListener('mouseover', handleMouseOver)
|
|
node.addEventListener('mouseout', handleMouseOut)
|
|
|
|
return () => {
|
|
node.removeEventListener('mouseover', handleMouseOver)
|
|
node.removeEventListener('mouseout', handleMouseOut)
|
|
}
|
|
}
|
|
},
|
|
[ref.current] // Recall only if ref changes
|
|
)
|
|
|
|
return [ref, value]
|
|
}
|
|
|
|
export default useHover
|