-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: review 관련 파일 삭제제 * feat: carousel 다운로드 * feat: 파일명을 proposalSection & proposal_list 생성 및 embla-carousel-autoplay로 게속 돌아가도록 설정정 * feat: Carousel Previous, Next 버튼 대칭 수정 및 사이즈 변경경 * feat: navBar에 proposal 추가 * feat: useState, useRef, useEffect, IntersectionObserver 사용하여 생성된 기획안 수에 대한 숫자 애니메이션 구현 * feat: 생성된 기획안 수에 대한 숫자 카드 구현 * feat: 토끼씨가 말한대로 접근성 및 콘텐츠 관리리 * feat: proposal_list 갯수를 7개에서 5개로 변경경 * feat: carousal image event 수정 및 count.toLocaleString 형태 변경 * feat: background 배경을 gray-100에서 white로 변경경
- Loading branch information
Showing
10 changed files
with
459 additions
and
65 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import { Card, CardContent } from "../ui/card"; | ||
import { | ||
Carousel, | ||
CarouselContent, | ||
CarouselItem, | ||
CarouselNext, | ||
CarouselPrevious, | ||
} from "../ui/carousel"; | ||
import { PROPOSAL_LIST } from "@/app/_consts/proposal_list"; | ||
import { useEffect, useRef, useState } from "react"; | ||
import Autoplay from "embla-carousel-autoplay"; | ||
|
||
export function ProposalSection() { | ||
const [count, setCount] = useState(0); | ||
const sectionRef = useRef(null); | ||
const [isVisible, setIsVisible] = useState(false); | ||
|
||
useEffect(() => { | ||
const observer = new IntersectionObserver( | ||
(entries) => { | ||
if (entries[0].isIntersecting) { | ||
setIsVisible(true); | ||
observer.disconnect(); | ||
} | ||
}, | ||
{ threshold: 0.1 } | ||
); | ||
|
||
if (sectionRef.current) { | ||
observer.observe(sectionRef.current); | ||
} | ||
|
||
return () => { | ||
if (observer && sectionRef.current) { | ||
observer.unobserve(sectionRef.current); | ||
} | ||
}; | ||
}, []); | ||
|
||
useEffect(() => { | ||
if (isVisible) { | ||
const targetNum = 10000; | ||
const duration = 2000; | ||
const increment = targetNum / (duration / 10); | ||
let currentNum = 0; | ||
const animateCount = () => { | ||
if (currentNum < targetNum) { | ||
currentNum += increment; | ||
setCount(Math.floor(currentNum)); | ||
requestAnimationFrame(animateCount); | ||
} else { | ||
setCount(targetNum); | ||
} | ||
}; | ||
animateCount(); | ||
} | ||
}, [isVisible]); | ||
|
||
const plugin = useRef(Autoplay({ delay: 5000, stopOnInteraction: true })); | ||
|
||
return ( | ||
<div ref={sectionRef}> | ||
<h1 className="font-black text-center text-6xl mt-10 font-serif"> | ||
Heading | ||
</h1> | ||
<Carousel | ||
plugins={[plugin.current]} | ||
className="w-full max-w-screen-sm p-5" | ||
onMouseEnter={plugin.current.stop} | ||
onMouseLeave={plugin.current.play} | ||
> | ||
<CarouselContent> | ||
{PROPOSAL_LIST.map((proposal) => ( | ||
<CarouselItem key={proposal.id}> | ||
<div className="p-1"> | ||
<Card> | ||
<CardContent className="flex aspect-square items-center justify-center"> | ||
<img | ||
src={proposal.image} | ||
alt={`${proposal.id}번 프로토절: ${proposal.title || "제목 없음"}`} | ||
/> | ||
</CardContent> | ||
</Card> | ||
</div> | ||
</CarouselItem> | ||
))} | ||
</CarouselContent> | ||
<CarouselPrevious className="w-20 h-20 -ml-5" /> | ||
<CarouselNext className="w-20 h-20 -mr-5" /> | ||
</Carousel> | ||
<div className="w-full max-w-screen-sm"> | ||
<h1 className="font-black text-center text-4xl m-10 font-sans"> | ||
생성한 기획안 수 {count.toLocaleString()} | ||
</h1> | ||
</div> | ||
</div> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.