Skip to content

Commit

Permalink
fix: quiz animation (picktoss#302)
Browse files Browse the repository at this point in the history
  • Loading branch information
rabyeoljji committed Dec 6, 2024
1 parent 6bc72ed commit b4c7e74
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 26 deletions.
17 changes: 7 additions & 10 deletions src/app/(routes)/document/[id]/(main)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { FunctionComponent, PropsWithChildren, Suspense } from 'react'
import { FunctionComponent, PropsWithChildren } from 'react'
import type { Metadata } from 'next'
import { DirectoryProvider } from '@/features/directory/contexts/directory-context'
import { DocumentProvider } from '@/features/document/contexts/document-context'
import RootLoading from '@/app/loading'

export const metadata: Metadata = {}

Expand All @@ -12,14 +11,12 @@ interface LayoutProps extends PropsWithChildren {

const Layout: FunctionComponent<LayoutProps> = ({ header, children }) => {
return (
<Suspense fallback={<RootLoading />}>
<DirectoryProvider>
<DocumentProvider>
{header}
{children}
</DocumentProvider>
</DirectoryProvider>
</Suspense>
<DirectoryProvider>
<DocumentProvider>
{header}
{children}
</DocumentProvider>
</DirectoryProvider>
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const FlameBomb = ({ leftQuizCount, onNext }: { leftQuizCount: number; onNext: (
opacity: [1, 0, 1, 0, 0],
}}
transition={{
duration: 0.5,
duration: 0.7,
delay: 0.5,
}}
onAnimationComplete={() => leftQuizCount === 1 && onNext()}
Expand Down
2 changes: 1 addition & 1 deletion src/features/quiz/screen/intro-and-quiz-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const IntroAndQuizView = ({
const handleAnimationComplete = () => {
const delayTimer = setTimeout(() => {
setFinishedIntro(true)
}, 1000)
}, 2000)

return () => clearTimeout(delayTimer)
}
Expand Down
22 changes: 8 additions & 14 deletions src/shared/components/custom/spring-up-card-animation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ const SpringUpCardAnimation = ({
initial={{ y: '500px', scaleX: 0, opacity: 0 }}
animate={{ y: '0%', scaleX: 1, opacity: 1 }}
transition={{
type: 'spring',
stiffness: 120,
damping: 20,
duration: 0.5,
duration: 0.7,
ease: [0.25, 0.1, 0.25, 1],
}}
onAnimationComplete={onAnimationComplete}
></motion.div>
Expand All @@ -43,11 +41,9 @@ const SpringUpCardAnimation = ({
initial={{ y: '300px', opacity: 0 }}
animate={{ y: '0%', opacity: 1 }}
transition={{
delay: 0.1,
type: 'spring',
stiffness: 130,
damping: 20,
duration: 0.1,
delay: 0.2,
duration: 0.3,
ease: [0.25, 0.1, 0.25, 1],
}}
>
{cardName}
Expand All @@ -58,11 +54,9 @@ const SpringUpCardAnimation = ({
initial={{ y: '100px', opacity: 0 }}
animate={{ y: '0%', opacity: 1 }}
transition={{
delay: 0.2,
type: 'spring',
stiffness: 150,
damping: 20,
duration: 0.3,
delay: 0.3,
duration: 0.4,
ease: [0.25, 0.1, 0.25, 1],
}}
>
{image}
Expand Down

0 comments on commit b4c7e74

Please sign in to comment.