Browse Source

chore: minor cleanup

master
Muthu Kumar 1 month ago
parent
commit
4357ac6ec5
Failed to extract signature
  1. 4
      src/components/DraggableButton.tsx
  2. 6
      src/components/Flippable.tsx
  3. 6
      src/pages/main/Contact.tsx

4
src/components/DraggableButton.tsx

@ -53,10 +53,6 @@ export const DraggableButton = React.forwardRef<
// Set position and clear any bottom/right values // Set position and clear any bottom/right values
el.style.position = "absolute"; el.style.position = "absolute";
// el.style.top = `${top}px`;
// el.style.left = `${left}px`;
// el.style.bottom = "unset";
// el.style.right = "unset";
el.style.transition = "none"; el.style.transition = "none";
setPosition({ x: left, y: top }); setPosition({ x: left, y: top });

6
src/components/Flippable.tsx

@ -5,17 +5,17 @@ export interface FlippableProps {
front: React.ReactNode; front: React.ReactNode;
back: React.ReactNode; back: React.ReactNode;
className?: string; className?: string;
defaultSide?: "front" | "back"; defaultFlipped?: boolean;
} }
export const Flippable: React.FC<FlippableProps> = ({ export const Flippable: React.FC<FlippableProps> = ({
front, front,
back, back,
className, className,
defaultSide, defaultFlipped,
}) => { }) => {
const ref = useRef<HTMLDivElement>(null); const ref = useRef<HTMLDivElement>(null);
const [isFlipped, setIsFlipped] = useState(defaultSide === "back"); const [isFlipped, setIsFlipped] = useState(defaultFlipped);
const mouseDownTime = useRef<number>(0); const mouseDownTime = useRef<number>(0);
const DRAG_THRESHOLD = 250; // milliseconds const DRAG_THRESHOLD = 250; // milliseconds

6
src/pages/main/Contact.tsx

@ -96,7 +96,7 @@ const Contact: React.FC = () => {
position: relative; position: relative;
`}> `}>
<h1>MKRhere</h1> <h1>MKRhere</h1>
{cardRotations.map((r, i) => ( {cardRotations.map((rot, i) => (
<DraggableButton <DraggableButton
key={i} key={i}
className={css` className={css`
@ -108,14 +108,14 @@ const Contact: React.FC = () => {
bottom: 0; bottom: 0;
left: 0; left: 0;
rotate: ${r}deg; rotate: ${rot}deg;
padding: 0; padding: 0;
background: transparent; background: transparent;
`} `}
ref={setupCursorTracking}> ref={setupCursorTracking}>
<Flippable <Flippable
defaultSide={i === cardRotations.length - 1 ? "front" : "back"} defaultFlipped={i !== cardRotations.length - 1}
front={ front={
<main <main
className={css` className={css`

Loading…
Cancel
Save