diff --git a/src/app/(sidebar)/my-recruit/page.tsx b/src/app/(sidebar)/my-recruit/page.tsx index ae770481..2fa65ea7 100644 --- a/src/app/(sidebar)/my-recruit/page.tsx +++ b/src/app/(sidebar)/my-recruit/page.tsx @@ -11,20 +11,24 @@ import { NewRecruitDialogContent } from './components/NewRecruitDialogContent/Ne import { RightSidebar } from './containers/RightSidebar/RightSidebar'; import { DndContextWithOverlay, DragEndEvent } from '@/lib/dnd-kit/dnd-kit'; import { InfoCard } from '@/components/InfoCard'; -import { AnimatePresence } from 'framer-motion'; +import { AnimatePresence, motion } from 'framer-motion'; import { usePostRecruit } from './api/usePostRecruit'; import { CardData } from './components/NewRecruitDialogContent/NewRecruitDialogContent'; import { cn } from '@/utils'; import { color } from '@/system/token/color'; import { usePostCardToRecruit } from './api/usePostCardToRecruit'; import { useScroll } from '@/hooks/useScroll'; +import { If } from '@/system/utils/If'; +import { fontSize } from '@/system/token/typography'; + +const STICKY_THRESHOLD = 30; export default function MyRecruit() { const [sidebarOpened, setSidebarOpened] = useState(false); const headerRef = useRef(null); const [isSticky, setIsSticky] = useState(false); - useScroll(headerRef.current, (y) => setIsSticky(y > 100)); + useScroll(headerRef, (y) => setIsSticky(y > STICKY_THRESHOLD)); const { mutate: mutatePostCard } = usePostRecruit(); const { mutate: mutatePostCardToRecruit } = usePostCardToRecruit(); @@ -40,18 +44,29 @@ export default function MyRecruit() { return ( -
+
-
- -
-

내 공고

+ +
+ +
+ + 내 공고 +
setSidebarOpened(!sidebarOpened)}> +
- - - 새 공고 + + + + {!isSticky && 새 공고} +
- + + + +
diff --git a/src/container/Sidebar/Sidebar.tsx b/src/container/Sidebar/Sidebar.tsx index e122d3b1..24ba5f37 100644 --- a/src/container/Sidebar/Sidebar.tsx +++ b/src/container/Sidebar/Sidebar.tsx @@ -7,8 +7,6 @@ import { Collapsible } from './Collapsible/Collapsible'; import { useRouter, usePathname } from 'next/navigation'; import { MY_RECRUIT_PATH, MY_INFO_PATH } from '@/route'; -// FIXME: -const SELECTED = true; const SIDEBAR_CLASSNAME = { expanded: 'w-[220px]', shrinked: 'w-[72px]', @@ -38,9 +36,7 @@ export function Sidebar() { {/* */} -
- void) { +export function useScroll(target: RefObject, callback: (topOffsetY: number) => void) { useEffect(() => { - const element = target ?? window; + const element = target.current ?? window; + console.log(element); const callback2 = () => { - const topOffsetY = target?.offsetTop ?? window.scrollY; + const topOffsetY = target.current?.scrollTop ?? window.scrollY; callback(topOffsetY); };