diff --git a/src/assets/icons/feedbacks/history-button-document.svg b/src/assets/icons/feedbacks/history-button-document.svg new file mode 100644 index 00000000..b9dd9ce4 --- /dev/null +++ b/src/assets/icons/feedbacks/history-button-document.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/assets/icons/feedbacks/intro-divider.svg b/src/assets/icons/feedbacks/intro-divider.svg new file mode 100644 index 00000000..994e6607 --- /dev/null +++ b/src/assets/icons/feedbacks/intro-divider.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/assets/icons/feedbacks/write-button-bg.svg b/src/assets/icons/feedbacks/write-button-bg.svg new file mode 100644 index 00000000..f0768283 --- /dev/null +++ b/src/assets/icons/feedbacks/write-button-bg.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/assets/icons/feedbacks/write-button-pencil.svg b/src/assets/icons/feedbacks/write-button-pencil.svg new file mode 100644 index 00000000..11153f06 --- /dev/null +++ b/src/assets/icons/feedbacks/write-button-pencil.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/features/feedbacks/FeedbacksListScreen.tsx b/src/features/feedbacks/FeedbacksListScreen.tsx index aadcd182..705ba042 100644 --- a/src/features/feedbacks/FeedbacksListScreen.tsx +++ b/src/features/feedbacks/FeedbacksListScreen.tsx @@ -1,13 +1,6 @@ import { TopNavigationButton, Typography } from "@wanteddev/wds"; import { IconBell, IconPlus, IconSearch } from "@wanteddev/wds-icon"; -import { - Suspense, - type UIEvent, - useEffect, - useLayoutEffect, - useRef, - useState, -} from "react"; +import { Suspense, useEffect, useRef, useState } from "react"; import { useLocation, useNavigate } from "react-router-dom"; import ScreenHeader from "@/components/ui/ScreenHeader"; @@ -15,8 +8,10 @@ import ScreenToast from "@/components/ui/ScreenToast"; import { useScreenHeader } from "@/components/ui/useScreenHeader"; import FeedbacksAllSection from "@/features/feedbacks/components/FeedbacksAllSection"; import FeedbacksAllSkeleton from "@/features/feedbacks/components/FeedbacksAllSkeleton"; +import FeedbacksIntro from "@/features/feedbacks/components/FeedbacksIntro"; import FeedbacksRecentCarousel from "@/features/feedbacks/components/FeedbacksRecentCarousel"; import FeedbacksRecentSkeleton from "@/features/feedbacks/components/FeedbacksRecentSkeleton"; +import { MY_FEEDBACKS_PATH } from "@/features/feedbacks/constants/feedbacks"; import { NOTIFICATIONS_PATH } from "@/features/notifications/constants/notifications"; import { getSearchPath } from "@/features/search/constants/search"; @@ -24,32 +19,37 @@ interface FeedbacksListLocationState { feedbackSent?: boolean; } -// FAB 축소 상태의 지름(Figma QA nodeId 2849:56930의 44px 원형 상태). -const FAB_COLLAPSED_WIDTH = 44; - -// Figma: 게시판 - 열린피드백 (nodeId 1410:50011), 피드백 전송 완료 토스트 (nodeId 1410:50080) +// Figma: 게시판 - 열린피드백 (nodeId 1410:50011), 피드백 전송 완료 토스트 (nodeId 1410:50080), +// 열린피드백 개선 UI 1123 (nodeId 5421:95607 — 맨 위 소개 영역과 스크롤 시 플로팅 버튼) // 헤더·FAB·토스트는 데이터와 무관해서 바로 그리고, "최근 피드백"과 "전체 피드백"은 각자 데이터를 받는 동안 // 자기 자리만 스켈레톤으로 채운다. function FeedbacksListScreen() { const navigate = useNavigate(); const location = useLocation(); - // 피드백 작성 FAB — 맨 위에서는 아이콘+텍스트, 스크롤해서 내려가면 아이콘만 남는 원형으로 - // 축소된다(Figma QA nodeId 2849:56930). "맨 위 복귀 시" 다시 텍스트가 붙으라는 요구라 - // 스크롤 방향이 아니라 맨 위(scrollTop === 0) 여부만 본다. - const [isFabExpanded, setIsFabExpanded] = useState(true); - const fabRef = useRef(null); - // width를 애니메이션하려면 확장 상태의 실제 폭이 필요하다(padding만 바꾸면 텍스트가 - // 마운트/언마운트되며 폭이 툭 튀어서 축소 방향만 애니메이션이 안 도는 것처럼 보였다). - // 텍스트를 상수로 재지 않고 DOM에서 실측한다 — 마운트 시 한 번만 잰다. isFabExpanded가 - // true로 바뀔 때마다 다시 재면, 축소→확장 전환 중(트랜지션이 아직 44px에서 안 벗어난 - // 시점)에 값을 읽어버려 폭이 44로 고정돼버리는 문제가 있었다. - const [fabExpandedWidth, setFabExpandedWidth] = useState(); + // 피드백 작성 플로팅 버튼 — 소개 영역의 '피드백 작성하기' 버튼이 보이는 동안은 숨기고, 스크롤해서 그 버튼이 + // 화면 밖으로 나가면 '+ 피드백 작성'으로 띄운다(Figma 5323:69763 "스크롤 시 플로팅", 디스크립션 4번). + // 같은 동작을 하는 버튼이 두 개 겹쳐 보이지 않게 하려는 것이라, 스크롤 위치 대신 그 버튼이 실제로 보이는지를 본다. + const scrollRef = useRef(null); + const writeButtonRef = useRef(null); + const [isFabVisible, setIsFabVisible] = useState(false); - useLayoutEffect(() => { - setFabExpandedWidth(fabRef.current?.getBoundingClientRect().width); + useEffect(() => { + const root = scrollRef.current; + const target = writeButtonRef.current; + if (!root || !target) { + return; + } + const observer = new IntersectionObserver( + ([entry]) => setIsFabVisible(!entry.isIntersecting), + { root }, + ); + observer.observe(target); + return () => observer.disconnect(); }, []); + const goToWrite = () => navigate("/feedbacks/new"); + // 피드백 작성 화면에서 넘어올 때만 history state로 신호를 받는다(navigate state) — 그 외 // 진입(바텀 탭 등)에서는 안 뜬다. 새로고침 시 재노출을 막으려고 받자마자 state를 비운다. const [isSentToastOpen, setIsSentToastOpen] = useState( @@ -64,10 +64,6 @@ function FeedbacksListScreen() { } }, [location.pathname, location.state, navigate]); - const handleContentScroll = (event: UIEvent) => { - setIsFabExpanded(event.currentTarget.scrollTop <= 0); - }; - // "공지"/"열린피드백" 토글은 게시판-공지 화면과 같은 ScreenHeaderToggleTitle을 쓴다. 이제 // 두 화면이 다 있어서 클릭하면 실제로 이동하도록 onChange를 연결한다(공지 쪽도 함께 연결). useScreenHeader( @@ -102,10 +98,18 @@ function FeedbacksListScreen() { return (
-
+
+ {/* 소개 영역 아래 여백 20px + 최근 피드백 위 8px(pt-2) = Figma 구분선 아래 28px */} +
+ + navigate(MY_FEEDBACKS_PATH, { viewTransition: true }) + } + onWrite={goToWrite} + writeButtonRef={writeButtonRef} + /> +
+ }> @@ -115,25 +119,20 @@ function FeedbacksListScreen() {
+ {/* 숨어 있을 때는 inert로 키보드·스크린리더에서도 빼서, 보이는 '피드백 작성하기' 버튼과 겹쳐 잡히지 않게 한다 */} + + +
+
+ + {/* 소개와 피드백 목록 사이 그라데이션 구분선 (Figma 5421:95622, 2px) */} + + + ); +} + +export default FeedbacksIntro; diff --git a/src/features/feedbacks/components/FeedbacksRecentCarousel.tsx b/src/features/feedbacks/components/FeedbacksRecentCarousel.tsx index 4796db0e..bcc47c55 100644 --- a/src/features/feedbacks/components/FeedbacksRecentCarousel.tsx +++ b/src/features/feedbacks/components/FeedbacksRecentCarousel.tsx @@ -8,11 +8,20 @@ import { getFeedbackPath } from "@/features/feedbacks/constants/feedbacks"; import { feedbacksQueries } from "@/shared/entities/feedbacks/feedbacksQueries"; import type { FeedbackResponse } from "@/shared/entities/feedbacks/feedbacksTypes"; -// 카드 한 장이 차지하는 가로 길이(카드끼리 gap이 없어서 카드 폭 그 자체다). 카드가 캐러셀 -// 폭에 꽉 차는 크기라 뷰포트마다 실제 폭이 다르기 때문에 상수로 박아두면 한쪽에서 점이 -// 어긋난다 — 실제 카드 폭을 DOM에서 재서 쓴다. -function getCarouselItemWidth(el: HTMLDivElement): number { - return el.firstElementChild?.getBoundingClientRect().width ?? 0; +// 한 장 넘길 때 움직이는 가로 거리(카드 폭 + 카드 사이 간격). 카드가 화면 폭에 맞춰 늘고 줄어서 +// 상수로 박아두면 뷰포트마다 점이 어긋난다 — 실제 카드 위치에서 잰다(홈 공지 배너와 같은 방식). +// 카드가 한 장뿐이면 넘길 일이 없어서 카드 폭을 그대로 쓴다. +function getCarouselStep(el: HTMLDivElement): number { + const [first, second] = el.children; + if (!first) { + return 0; + } + if (!second) { + return first.getBoundingClientRect().width; + } + return ( + second.getBoundingClientRect().left - first.getBoundingClientRect().left + ); } // 스와이프/드래그로 인정할 최소 이동 비율(카드 폭 대비). 이보다 짧게 움직이면 그대로 @@ -90,11 +99,11 @@ function FeedbacksRecentCarouselView({ if (!el) { return; } - const itemWidth = getCarouselItemWidth(el); - if (!itemWidth) { + const step = getCarouselStep(el); + if (!step) { return; } - setCarouselPage(Math.round(el.scrollLeft / itemWidth) + 1); + setCarouselPage(Math.round(el.scrollLeft / step) + 1); }; const scrollCarouselToPage = (page: number) => { @@ -104,7 +113,7 @@ function FeedbacksRecentCarouselView({ } el.scrollTo({ behavior: "smooth", - left: (page - 1) * getCarouselItemWidth(el), + left: (page - 1) * getCarouselStep(el), }); }; @@ -166,8 +175,10 @@ function FeedbacksRecentCarouselView({ // 페이지를 다시 목표로 잡아버린다(실사용 중 발견) — 스크롤이 실제로 끝나길 기다리지 // 않고 여기서 바로 "의도한 다음 페이지"로 미리 갱신해 둔다. carouselPageRef.current = nextPage; - const itemWidth = getCarouselItemWidth(el); - el.scrollTo({ behavior: "smooth", left: (nextPage - 1) * itemWidth }); + el.scrollTo({ + behavior: "smooth", + left: (nextPage - 1) * getCarouselStep(el), + }); }; el.addEventListener("wheel", handleWheel, { passive: false }); return () => el.removeEventListener("wheel", handleWheel); @@ -257,12 +268,12 @@ function FeedbacksRecentCarouselView({ } const { lastDeltaX, velocityX, startPage } = drag; drag = null; - const itemWidth = getCarouselItemWidth(el); - if (!itemWidth) { + const step = getCarouselStep(el); + if (!step) { return; } const isFarEnough = - Math.abs(lastDeltaX) > itemWidth * CAROUSEL_DRAG_COMMIT_RATIO; + Math.abs(lastDeltaX) > step * CAROUSEL_DRAG_COMMIT_RATIO; const isFlick = Math.abs(velocityX) > CAROUSEL_FLICK_VELOCITY_PX_MS; // 드래그 도중 라이브 스크롤 위치로 갱신된 carouselPageRef가 아니라, 제스처 시작 시점에 // 고정해 둔 startPage를 기준으로 계산한다 — 그래야 카드 폭 절반을 넘게 끌어도 정확히 @@ -278,7 +289,7 @@ function FeedbacksRecentCarouselView({ // 바로 "의도한 다음 페이지"를 기록해 둔다 — 그래야 스크롤 애니메이션이 끝나기 전에 // 바로 이어서 스와이프해도 같은 카드를 다시 목표로 잡지 않는다. carouselPageRef.current = nextPage; - el.scrollTo({ behavior: "smooth", left: (nextPage - 1) * itemWidth }); + el.scrollTo({ behavior: "smooth", left: (nextPage - 1) * step }); }; el.addEventListener("touchstart", handleTouchStart, { passive: true }); @@ -295,8 +306,9 @@ function FeedbacksRecentCarouselView({ return ( <> -
+
+ {/* 좌우 여백(px-5)을 스크롤 영역 안쪽에 둬서 넘길 때 카드가 여백에서 잘리지 않고 화면 끝까지 보이게 한다 + (Figma 수정 요청 5364:2813, 홈 공지 배너와 같은 방식). 멈추는 자리는 scroll-px-5로 여백 안쪽에 맞추고, + 카드는 지금처럼 여백 안쪽 폭에 꽉 차게 둔다. 카드 사이(gap-10)를 좌우 여백 합(40px)과 같게 둬서 + 한 장이 멈춰 있을 때 이웃 카드는 화면 밖에 있다. */}
diff --git a/src/index.css b/src/index.css index 7e5f20a8..8391e2f8 100644 --- a/src/index.css +++ b/src/index.css @@ -60,6 +60,9 @@ /* 학생회비 송금 — 업로드한 파일 행 배경(Figma "Atomic/Blue/99", 3562:162922). primary-subtle(Blue/95)보다 훨씬 옅어서 흰 카드 위에서 행만 살짝 떠 보인다 */ --color-blue-99: var(--atomic-blue-99); + /* 열린피드백 소개 버튼 — '피드백 작성하기' 배경과 '작성내역 보기' 테두리(Figma "Atomic/Blue/60", 5421:95620). + primary(Blue/50)보다 한 단계 밝은 파랑이다 */ + --color-blue-60: var(--atomic-blue-60); --color-line-solid-alternative: var(--semantic-line-solid-alternative); --color-status-positive: var(--semantic-status-positive);