diff --git a/public/assets/christmas.png b/public/assets/christmas.png deleted file mode 100755 index a60a580..0000000 Binary files a/public/assets/christmas.png and /dev/null differ diff --git a/src/components/PositionButton.tsx b/src/components/PositionButton.tsx deleted file mode 100644 index 3bf68f2..0000000 --- a/src/components/PositionButton.tsx +++ /dev/null @@ -1,89 +0,0 @@ -import { Box, Image } from '@chakra-ui/react' -import { useMotionValue } from 'framer-motion' -import { useEffect, useRef } from 'react' - -import ChakraMotion from './ChakraMotion' - -type Props = { - onClick: () => void -} - -const PositionButton = ({ onClick }: Props) => { - const x = useMotionValue(0) - const y = useMotionValue(0) - - const ref = useRef(null) - const isDragging = useRef(false) - - const onPointChange = (point: { x: number; y: number }) => { - chrome.storage.local.set({ point }) - x.set(point.x) - y.set(point.y) - } - - useEffect(() => { - chrome.storage.local.get(({ point }) => { - if (point) { - x.set(point.x) - y.set(point.y) - - return - } - - chrome.storage.local.set({ point: { x: 0, y: 0 } }) - x.set(0) - y.set(0) - }) - }, []) - - return ( - - { - isDragging.current = true - }} - onDragEnd={() => { - isDragging.current = false - const { x, y } = ref.current.children[0].getBoundingClientRect() - onPointChange({ x, y }) - }} - initial={{ opacity: 0 }} - animate={{ opacity: 1 }} - exit={{ opacity: 0 }} - viewport={{ once: true }} - transition={{ duration: 0.3 }} - position="absolute" - w="100px" - h="100px" - style={{ - x, - y, - }} - cursor="pointer" - pointerEvents="auto" - onClick={() => { - if (!isDragging.current) onClick() - }} - /> - - ) -} - -export default PositionButton