diff options
| author | Mitchell Riedstra <mitch@riedstra.dev> | 2022-12-26 00:11:58 -0500 |
|---|---|---|
| committer | Mitchell Riedstra <mitch@riedstra.dev> | 2022-12-26 00:11:58 -0500 |
| commit | fd3e3280a2590be9ca074a172c535990a5035649 (patch) | |
| tree | 232f23010449a5aea88052c6e860a68ef9bdeb34 /paste-ui/src/stateExample.js | |
| parent | 0704674ba408db54855c33bcb8ca71a7ae1e74b7 (diff) | |
| download | paste-fd3e3280a2590be9ca074a172c535990a5035649.tar.gz paste-fd3e3280a2590be9ca074a172c535990a5035649.tar.xz | |
Add a proxy option for static assets. Fix the paste view handlers.
Diffstat (limited to 'paste-ui/src/stateExample.js')
| -rw-r--r-- | paste-ui/src/stateExample.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/paste-ui/src/stateExample.js b/paste-ui/src/stateExample.js new file mode 100644 index 0000000..91fee18 --- /dev/null +++ b/paste-ui/src/stateExample.js @@ -0,0 +1,32 @@ +import { useState } from 'react'; +export default function MovingDot() { + const [position, setPosition] = useState({ + x: 0, + y: 0 + }); + return ( + <div + onPointerMove={e => { + setPosition({ + x: e.clientX, + y: e.clientY + }); + }} + style={{ + position: 'relative', + width: '100vw', + height: '100vh', + }}> + <div style={{ + position: 'absolute', + backgroundColor: 'red', + borderRadius: '50%', + transform: `translate(${position.x}px, ${position.y}px)`, + left: -10, + top: -10, + width: 20, + height: 20, + }} /> + </div> + ); +}
\ No newline at end of file |
