old.nicco.io/components/Cursor.tsx

25 lines
484 B
TypeScript
Raw Normal View History

2019-03-03 16:13:57 +01:00
import React from 'react'
2020-01-05 17:34:03 +01:00
import { useIsMousePresent, useMousePosition } from '../utils/hooks'
2019-03-03 16:13:57 +01:00
const Cursor: React.FC = () => {
const mouse = useMousePosition()
const present = useIsMousePresent()
return present
? <span style={{
position: 'fixed',
top: mouse.absolute.y,
left: mouse.absolute.x,
width: '1em',
height: '1em',
borderRadius: '1em',
transform: 'translate(-50%, -50%)',
backgroundColor: '#000000',
2020-01-05 17:34:03 +01:00
}} />
2019-03-03 16:13:57 +01:00
: null
}
export default Cursor