old.nicco.io/components/Cursor.tsx
2020-01-05 17:34:03 +01:00

25 lines
484 B
TypeScript

import React from 'react'
import { useIsMousePresent, useMousePosition } from '../utils/hooks'
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',
}} />
: null
}
export default Cursor