Skip to content

Commit

Permalink
refactor: clean up imports and remove unused hooks in expandable card…
Browse files Browse the repository at this point in the history
… and projects section
  • Loading branch information
NarwhalChen committed Mar 5, 2025
1 parent 1f97076 commit d19be43
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
7 changes: 2 additions & 5 deletions frontend/src/components/root/expand-card.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
'use client';
import Image from 'next/image';
import React, { useEffect, useId, useRef, useState } from 'react';
import React, { useEffect, useRef, useState } from 'react';
import { AnimatePresence, motion } from 'framer-motion';
import { useOutsideClick } from '@/hooks/use-outside-click';
import { X } from 'lucide-react';

export function ExpandableCard({ projects }) {
const [active, setActive] = useState(null);
const [iframeUrl, setIframeUrl] = useState('');
const id = useId();
const ref = useRef<HTMLDivElement>(null);

useEffect(() => {
Expand All @@ -28,8 +26,6 @@ export function ExpandableCard({ projects }) {
return () => window.removeEventListener('keydown', onKeyDown);
}, [active]);

useOutsideClick(ref, () => setActive(null));

const getWebUrl = async (project) => {
if (!project) return;
console.log('project:', project);
Expand Down Expand Up @@ -59,6 +55,7 @@ export function ExpandableCard({ projects }) {
<AnimatePresence mode="wait">
{active && (
<motion.div
onClick={() => setActive(null)}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
Expand Down
6 changes: 1 addition & 5 deletions frontend/src/components/root/projects-section.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { gql, useQuery } from '@apollo/client';
import Image from 'next/image';
import { useState } from 'react';
import { X } from 'lucide-react';
import { useQuery } from '@apollo/client';
import { FETCH_PUBLIC_PROJECTS } from '@/graphql/request';
import path from 'path';
import { ExpandableCard } from './expand-card';

export function ProjectsSection() {
Expand Down

0 comments on commit d19be43

Please sign in to comment.