old.nicco.io/src/Components/Cursor.tsx

22 lines
473 B
TypeScript
Raw Normal View History

2019-03-03 16:13:57 +01:00
import React from 'react'
import { useIsMousePresent, useMousePosition } from '../util'
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